WordPress.org

Ready to get started?Download WordPress

Forums

Ultimate TinyMCE
[resolved] How to add shortcodes (13 posts)

  1. Jacob N. Breetvelt
    Member
    Posted 1 year ago #

    I am a plugin developer who wants to add the plugni's shortcodes to the shortcode dorpdown box.
    How do i tell tinymce what my plugins shortcodes are and how to configure them?

    http://wordpress.org/extend/plugins/ultimate-tinymce/

  2. Josh (WP Edit)
    Volunteer Moderator
    Plugin Author

    Posted 1 year ago #

    I know. I started using your Photo Album plugin and familiarizing myself with all of the customizing options. Impressive!!

    The shortcodes dropdown I use in my plugin seeks out any shortcode defined in any of the functions files and lists them in the dropdown.

    As long as you follow the proper format for defining your shortcodes, they should automatically appear in the dropdown.

    One thing you might want to consider is adding a button to tinymce which gives the end-user the ability to edit any attributes included in the shortcode.

    What will your shortcode allow the user to accomplish?

  3. Jacob N. Breetvelt
    Member
    Posted 1 year ago #

    As long as you follow the proper format for defining your shortcodes, they should automatically appear in the dropdown.

    Where do i find a description of what the proper format is?

    One thing you might want to consider is adding a button to tinymce which gives the end-user the ability to edit any attributes included in the shortcode.

    I would also like to know how to do this

    What will your shortcode allow the user to accomplish?

    Currently we use scripts like:

    %%wppa%% %%album=13%% %%photo=123%% %%size=400%%

    The syntax is fully described here. This must stay supported for backward compatibility, but i want to make a new shortcode system.
    Something like [wppa:album=13;photo=123;size=400] where the sequence order of the tokens is no longer relevant (as it is now). Also some switches must be included, like slide=true and also there are keywords like album=#topten,13,10

  4. Josh (WP Edit)
    Volunteer Moderator
    Plugin Author

    Posted 1 year ago #

    Okay, great.

    So, I think you should add a button which allows the user to choose these options. For example,

    1. They get to a point where they would like to include an album.
    2. They click a new WPPA button in the editor.
    3. A popup opens, allowing the user to input the album number, photo number, size, etc.
    4. Then they can click insert on the popup, and all settings will be inserted into the editor.

    This is much better over simply using a shortcode. Users may forget the proper syntax when using shortcodes. By giving them a modal popup to set attributes... users are not required to memorize any shortcode usages.

    So, let me get together some resources and I'll post back here shortly.

    Go ahead and start becoming familiar with the info in this link:
    http://www.garyc40.com/2010/03/how-to-make-shortcodes-user-friendly/

  5. Josh (WP Edit)
    Volunteer Moderator
    Plugin Author

    Posted 1 year ago #

    Okay, I've kind of started this for you.

    Basically, you are going to have two additional sections of code. The first is going to hook everything into wordpress and instantiate both the plugin and the button. Here is the start to that part of the code:
    http://pastebin.com/MfSFJt7V

    This will most likely go in the file you are using to create all your admin panel options.

    Next, we need a js file to handle the button. This is more intense to get setup properly. Here is a link to the code used by the example I sent above... however it's going to need some modifications:
    http://pastebin.com/GNPMzYqc

    Let me know how you progress with this.. and I'll check back when I get home.

  6. Jacob N. Breetvelt
    Member
    Posted 1 year ago #

    Thanx do far, i am very busy, this will take some time...

  7. Josh (WP Edit)
    Volunteer Moderator
    Plugin Author

    Posted 1 year ago #

    I understand. When I get some free time, I'll take another look at this and see if I can take it another step for you.

    You have a fantastic plugin... and I recommend it to all my clients!

  8. oduudo
    Member
    Posted 1 year ago #

    Yeah, that's true,
    I love both your plugins.
    I think, ultimate tinymce as editor in conjunction with wppa as picture and album manager would be a fantastic duo.
    I love them both, but some integration wolud help a lot!
    thanks for your fantastic work!
    Udo

  9. Jacob N. Breetvelt
    Member
    Posted 1 year ago #

    @josh:

    I finally got time to work on this 'project'.
    I have however a few begiiners troubles.

    I included the .php example file like this:

    /* GENERAL ADMIN */
    
    // General purpose admin functions
    require_once 'wppa-admin-functions.php';
    require_once 'wppa-tinymce.php';

    in wppa-admin.php, where wppa-tinymce.php is the example file.

    Also i named the .js wppa-tinymce.js, and changed the name in wppa-tinymce.php so the last function now read:

    function filter_mce_plugin( $plugins ) {
    	// this plugin file will work the magic of our button
    	$plugins['wppa'] = plugin_dir_url( __FILE__ ) . 'wppa-tinymce.js';
    	return $plugins;
    }

    What i expect now is to see in the tinymce admin panel and in the buttonrows above the visual editor somethin that refers to:

    title : 'MyGallery Shortcode', // title of the button
    image : '../wp-includes/images/smilies/icon_mrgreen.gif',  // path to the button's image

    but... please tell me what i am doing wrong.

  10. Josh (WP Edit)
    Volunteer Moderator
    Plugin Author

    Posted 1 year ago #

    Hey, my friend. Yeah, I've been busy as crazy also.

    I'm in class right now, but I'll take a look tonight, I promise.

    Are you wanting to insert your button above the editor? Or as a button inside the visual editor?

  11. Jacob N. Breetvelt
    Member
    Posted 1 year ago #

    I would expect that the button appears in one of the four rows above the visual editor, and, if possible switcheable and configurable (row number) in the ultimate tinymce setings panel.

    It would be no problem for me if having your plugin installed is required for my button to be usable.

    What is the easyest way to determine if your plugin is installed?
    (a define or the existence of a global where i can test on?)

  12. Josh (WP Edit)
    Volunteer Moderator
    Plugin Author

    Posted 1 year ago #

    Gotcha. Perfect.

    Let's see... you can always check to see if a plugin exists by using is_plugin_active:

    <?php
       if (is_plugin_active('ultimate-tinymce/main.php')) {
          //plugin is activated
       }
    ?>

    http://codex.wordpress.org/Function_Reference/is_plugin_active

    I'm going to work on this for a little bit right now, and try to finish it up tomorrow.

    Would you mind using my contact form to send me your current beta version? Just send me an email and I'll respond... then you can attach it.

    http://joshlobe.com/contact-me/

  13. Josh (WP Edit)
    Volunteer Moderator
    Plugin Author

    Posted 1 year ago #

    Resolved.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.