Pippins Plugins
  • Email
  • Facebook
  • Feedburner
  • Github
  • Google
  • Twitter
  • Vimeo
  • Youtube
  • Rss
  • About
  • News
  • Join the Site
    • Member Benefits
    • Member Plugins
    • Email Notifications
  • Plugin Store
    • Affiliate Area
    • Checkout
  • Plugins
    • Plugin Portfolio
      • Plugin Portfolio – List View
    • Free
    • Premium
    • Member Plugins
    • Coding Standards
    • Get Plugin Support
  • Tutorials
    • Series
      • Plugin Development 101
      • Creating a User Follow System Plugin
      • Customizing Restrict Content Pro
      • Displaying Content with Easy Content Types
      • Writing Your First WordPress Plugins, Basic to Advanced
      • Working with Widgets
      • User Submitted Image Galleries
      • Plugin Thoughts
      • Integrating Stripe.com with WordPress
      • WordPress Rewrite API
    • Member Exclusive
      • Free Members
      • Subscriber Only
    • Difficulty
      • Beginner
      • Intermediate
      • Advanced
    • Action and Filter Hooks
    • Ajax
    • Custom Post Types
    • External APIs
    • Short Codes
    • Taxonomies
    • Video Tutorials
    • Widget Tutorials
    • WordPress Admin / Dashboard
    • Working with jQuery
    • WordPress Database
    • Writing Plugins
    • Tag Index
  • Reviews
  • Support Forum
  • Contact
    • Support the Site
    • Request Code Review
    • Plugin Support

User Friendly Short Codes Plugin Example

Posted on May 30, 2011 by Pippin in Free, Plugins, Short Codes, Utilities 67 Comments
Home» Plugins » Free » User Friendly Short Codes Plugin Example
Tweet
Love It - 5

Short Codes are great, except that they are not always very user friendly, especially for those users that are not very familiar with programming, because, let’s face, short codes look like code.


This plugin will provide a short code that can be used to insert a selection of CSS 3 buttons, but unlike most short code plugins, this comes with a nice tinyMCE button to insert / configure your short code.

The available buttons are:

And the interface for inserting buttons looks like this:

Features

  • 5 Button Colors
  • 3 Button Sizes
  • 3 Button Styles
  • TinyMCE button with Modal Popup to insert short codes easily

The short code attributes are:

color=

  • gray
  • blue
  • red
  • green
  • black

size=

  • small
  • medium
  • large

style=

  • less_round
  • round
  • square

align=

  • left
  • right
  • none

url=clickable url

text=button text

A complete short code may look like this:

[button size=medium style=round color=blue align=left url=http://google.com]button text[/button]

Note, this plugin is more of an example of how to setup a modal window for your short code attributes than anything super functional, but it does still provide a couple of nice looking buttons.

There is a very in depth tutorial on how to write this plugin available at Pro Blog Design.

Change Log

1.0.1 - Made button non clickable if URL field left blank
Download
Tweet Follow @pippinsplugins
modal, short codes, shortcodes

67 comments on “User Friendly Short Codes Plugin Example”

Comment navigation

← Older Comments
  1. Mike says:
    January 12, 2012 at 9:07 am

    Hi, great plugin, just wondered if it’s possible to add a QuickTag button for the HTML editor to open the modal window?

    Reply
    • Pippin says:
      January 12, 2012 at 11:10 am

      It’s possible for sure, though I’ve never investigated how to do it. If I come across it, I will write up a tutorial on it.

  2. sandeep says:
    January 13, 2012 at 5:24 am

    useful plugin thanks for sharing :)

    Reply
  3. Dave Porter says:
    January 16, 2012 at 9:03 pm

    Hi Pippin,

    Thanks for this, nice an simple and easy to use…

    It works fine if I manually enter the shortcode, but the popup dialog appears, but the Insert link does not work (and it is text, not a button like in your picture above!

    Cheers Dave

    ps Do you have a suggested tab-page plugin ?

    Reply
    • Dave Porter says:
      January 16, 2012 at 9:14 pm

      Just a follow up – I found another problem!

      If I use the following shortcode it works fine:
      [button size=small style=round color=gray align=right url=http://example.com]Full details…[/button]

      But if I add a page after the url like this:

      [button size=small style=round color=gray align=right url=http://example.com/some-page/]Full details…[/button]

      It is broken ! small button appears, with not text and the “Full Details…[/button]” appears as text, outside of the button !

      TIA, Dave

    • Pippin says:
      January 17, 2012 at 10:14 am

      Dave, wrap the url in quotes, like this:

      [button size=small style=round color=gray align=right url="http://example.com"]Full details…[/button]

    • Pippin says:
      January 17, 2012 at 10:11 am

      Have you followed the tutorial or are you just trying to use the plugin?

      No, sorry, I don’t ever use tabs so haven’t ever tried any plugins.

  4. Dave Porter says:
    January 17, 2012 at 5:36 pm

    Thanks Pippin, I’ll try that !
    The tutorial looks great, but at this stage just need to get the plugin working…
    Cheers, Dave

    Reply
  5. User Friendly Short Codes with TinyMCE | Cyber Web Designs says:
    March 9, 2012 at 6:44 am

    [...] If doing all the manual coding yourself isn’t quite your thing, you’re in luck! I have put the code from this tutorial into a complete plugin that you can download for free at my website: Pippin’s Plugins.com [...]

    Reply
  6. Rakhitha Nimesh says:
    March 13, 2012 at 12:20 am

    I tried the plugin and the script files are not getting loaded with the modal window. Can you tell me what the issue is

    Reply
    • Pippin says:
      March 13, 2012 at 9:05 am

      Do you have WordPress installed in a sub directory?

  7. Vivek Nath. says:
    March 13, 2012 at 8:56 am

    Hi Pippin,
    I download your plugin and installed in my plugins folder. My question is- How i insert this buttons in post?
    thanks.

    Reply
    • Pippin says:
      March 13, 2012 at 9:06 am

      Do you see the button added to the toolbar? You will have to be in the visual editor mode.

  8. Bart says:
    March 15, 2012 at 1:35 pm

    It doesn’t work for me too.

    There’s a button in TinyMCE, when I click it the plugin’s window pops up and this is it.

    There are no styles and “Insert” button does literally nothing.

    Here’s how it looks like: http://i.imgur.com/LGuUf.png

    I’m just a beginner, but I believe the problem lies within button_popup.php file, lines 8-11.

    “../../” should be replaced with something like “WORDPRESS_DIRECTORY”, the same goes for stylesheet’s URL, am I right? :)

    Reply
    • Pippin says:
      March 15, 2012 at 2:14 pm

      You are both right and wrong. The ../../ represent the directory path TO the WordPress directory, though it is probably incorrect for your install. Do you have WordPress installed in a sub directory?

  9. Bart says:
    March 15, 2012 at 2:27 pm

    Nope and nope. I’ve been trying on my localhost (http://localhost/wordpress) and my blog, and the same thing happens. No subdirectories in both cases. The latest WordPress version. I know I should change “../../” to “../../../” or “../../../../..” etc. in case of subdirectory.

    I believe there’s a problem with the plugin since even link to stylesheet doesn’t work (out of the box).

    Does it really work for you?

    Reply
    • Pippin says:
      March 15, 2012 at 3:28 pm

      Yes, it really does work for me, but remember, this plugin is just meant as a sample. It has not really been built as a complete, ready-to-use plugin. It was built for a tutorial that shows how to write a plugin like this: http://www.problogdesign.com/wordpress/user-friendly-short-codes-with-tinymce/

      What needs to happen with this plugin (and I did not do it because this was meant as an example) is the path to the WordPress directory needs to be determined automatically, not hard coded.

  10. Bart says:
    March 15, 2012 at 7:05 pm

    Sorry if that sounded harsh, I’m not an English native :) This plugin rocks, I’ve been digging around TinyMCE tweaking for a pretty long time and you’re a life saver :) So folks, if this doesn’t work for you just edit your button_popup.php scripts and stylesheets sources. By the way, any hints how to do that? I believe it will require at least require_once(../wp-load.php) and that’s never good? :)

    Reply
    • Pippin says:
      March 15, 2012 at 8:30 pm

      Yes, you need to load WordPress, which can be done by including wp-load.php. It’s not a good idea, but sometimes it is the best method. Though I’m sure there is a much better way to do it; it’s just a matter of sitting back down and figuring out the correct path calculation.

  11. Jefry says:
    July 18, 2012 at 8:21 pm

    thank you
    I will soon install this plugin on my blog

    Reply
  12. Gonzo – Clean, Responsive WP Magazine | Buzzingart says:
    July 21, 2012 at 1:41 am

    [...] User-friendly Buttons: Pippin’s Plugins [...]

    Reply
  13. Gonzo – Clean, Responsive WP Magazine | WPPOT says:
    October 11, 2012 at 4:40 am

    [...] User-friendly Buttons: Pippin’s Plugins [...]

    Reply
  14. Lynette says:
    March 14, 2013 at 6:55 am

    Hi Pippin, thank you SO much for this. I’ve used it as a basis for several plugins and it has always worked flawlessly. Since WP version 3.5 though I’ve noticed something annoying.

    If you select some text first, then click the button to do what you want to do, all works well as expected. The problem comes when you select an entire paragraph, click the button, make your choices and click insert, it sorta crashes. Nothing happens, TinyMCE quits and you can’t switch between visual and text editor. All things Javascript quits until you refresh the page. That’s on Firefox. On Chrome, it adds the shortcode but at the top of the editor before all other content, not enclosing the selected text as it should.

    On Firefox, I get the error “WrongDocumentError: Node cannot be used in a document other than the one in which it is created” My javascript skills are weak but it sounds like something to do with the dialog box being another document/page? Any thoughts?

    Reply
    • Pippin says:
      March 14, 2013 at 8:47 pm

      Hmm, I’ve never seen that error. Does it definitely not happen prior to 3.5?

    • Lynette says:
      March 15, 2013 at 7:22 am

      Yup. I installed a fresh copy of 3.4 to test – because I was sure we’d never seen this when building the plugin. I also tried it on your copy, downloaded it from here. Same results.

      Going back to the older comments, I did try removing the mceRemoveNode line. That immediately took care of the problem. I liked the idea of trying to clear other nodes first so that it doesn’t interfere with the new code/button we’ll be adding using the plugin, I had to make it functional.

      Just thought I’d report this in case anyone has issues or if you have some new ideas on this. Thank you so very much for this – again :)

  15. Gonzo – Clean, Responsive WP Magazine says:
    April 19, 2013 at 6:16 am

    [...] User-friendly Buttons: Pippin’s Plugins [...]

    Reply

Comment navigation

← Older Comments

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Login

Lost your password?

Please enter your username or e-mail address. You will receive a new password via e-mail.

  • Facebook Become a Fan Like

  • Twitter Subscribe on Twitter Follow

  • YouTube Follow my Videos Subscribe

  • RSS Feed Subscribe with RSS Subscribe

Easy Digital Downloads

Most Loved

  • Love It Pro for WordPress
  • Write a “Love It” Plugin with Ajax to Let Users Love Their Favorite Posts / Pages
  • Simple Notices Pro Plugin for WordPress
  • User Bookmarks for WordPress
  • Front End Registration and Login Forms Plugin

Similar Plugins and Posts

  • Never Remove the Default the_content Filters in Themes
  • Sugar Modal Windows Plugin
  • Load Scripts if Post has Short Code
  • WP Utility Short Codes Plugin
  • Shortcodes Pro Premium Plugin Review

Latest Premium Content

  • Plugin Development 101 – Introduction to Adding Dashboard Menus
  • Plugin Development 101 – Intro to Loading Scripts and Styles
  • User Follow System – Part 5
  • Plugin Development 101 – Intro to Short Codes

Latest Tutorials

  • Storing Session Data in WordPress without $_SESSION (19)

    The term Session in web development refers to...

  • Test Your Plugins with RTL (1)

    Right-To-Left languages are those that...

  • Submitting Your First Pull Request to a WordPress Plugin on Github (5)

    Github is an extremely popular tool for managing WordPress plugins, and one...

Enter your email to receive automated updates when new posts are published

WP Core Contributions

  • [24316]

View the ticket on Trac.

WP Codex Contributions

  • Function: shortcode exists
  • Function: has shortcode
  • Function: shortcode exists
  • Function: shortcode exists
  • Function: has shortcode

View all 41 changes in the Codex.

Latest Tweets

  • Could not fetch Twitter RSS feed.

Topics

register_setting shortcodes attachments add_options_page Tom McFarlin get_user_meta hook add_shortcode meta box Sugar Event Calendar wp_enqueue_script contextual help featured short codes plugin do_action login Related posts authors mail chimp attachment image forms post types apply_filters comments recent posts short code bbpress taxonomies custom post type Ajax gallery images Stripe jquery taxonomy widgets users add_filter easy content types add_action widget restrict content pro easy digital downloads

Weekly Newsletter

Useful Links

  • Join the Site
  • Plugin Store
  • Affiliate Area
  • Tag Index
  • Support the Site
  • Suggest a Tutorial
  • Random Post
  • Contact

Monthly Archives

(c) 2013 Pippin's Plugins