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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Wordpress Shortcode Button

  • 09-05-2012 11:31AM
    #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, Registered Users 2 Posts: 6,605 ✭✭✭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