Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Josh

    (@josh401)

    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?

    Thread Starter Jacob N. Breetvelt

    (@opajaap)

    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

    Plugin Author Josh

    (@josh401)

    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:
    https://www.garyc40.com/2010/03/how-to-make-shortcodes-user-friendly/

    Plugin Author Josh

    (@josh401)

    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:
    https://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:
    https://pastebin.com/GNPMzYqc

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

    Thread Starter Jacob N. Breetvelt

    (@opajaap)

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

    Plugin Author Josh

    (@josh401)

    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!

    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

    Thread Starter Jacob N. Breetvelt

    (@opajaap)

    @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.

    Plugin Author Josh

    (@josh401)

    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?

    Thread Starter Jacob N. Breetvelt

    (@opajaap)

    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?)

    Plugin Author Josh

    (@josh401)

    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
       }
    ?>

    https://codex.www.ads-software.com/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.

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

    Plugin Author Josh

    (@josh401)

    Resolved.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Plugin: Ultimate TinyMCE] How to add shortcodes’ is closed to new replies.