Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Wordpress Shortcode Button

Options
  • 09-05-2012 12:31pm
    #1
    Moderators, Computer Games Moderators Posts: 10,462 Mod ✭✭✭✭


    Im trying to create a shortcode button that when clicked will add some text to the current location of the cursor in the editor below.

    I have been looking at the tutorial http://wp.tutsplus.com/tutorials/theme-development/wordpress-shortcodes-the-right-way/ - the last section at the bottom deals with adding a button the makes a link out of selected text.

    Im trying to modify this to just add text when clicked but cant get it to work.

    I replaced the last function in the customcodes.js with this but its not working properly. Any ideas?
    (function() {  
            tinymce.create('tinymce.plugins.quote', {  
                init : function(ed, url) {  
                    ed.addButton('quote', {  
                        title : '€',  
                        image : url+'/image.png',  
                        onclick : function() {  
                         return 'Text Text Text '; 
          
                        }  
                    });  
                },  
                createControl : function(n, cm) {  
                    return null;  
                },  
            });  
            tinymce.PluginManager.add('quote', tinymce.plugins.quote);  
        })();  
    


Comments

  • Registered Users Posts: 6,511 ✭✭✭daymobrew


    Axwell wrote: »
    Im trying to modify this to just add text when clicked but cant get it to work.
    Two questions:
    1) Could you get the example in the WPTuts article working?
    2) Are there any errors or warnings displayed in Firebug or Error Console?


Advertisement