WordPress.org

Ready to get started?Download WordPress

Forums

AddQuicktag
[resolved] Change 'Quicktags' name in dropdown & Move row (8 posts)

  1. Paul Thomson
    Member
    Posted 1 year ago #

    Hello Frank!

    Absolutely EPIC plugin thanks so much for developing, very simple, easy to use and it works!

    I was wondering if you could help me do two things? I would like to rename the title of the dropdown menu to something else, also move the row down to row 4 as I have some other custom TinyMCE buttons I would like your plugin to sit next to.

    screenshot for more clarification.

    Thanks again Frank,
    Paul

    http://wordpress.org/extend/plugins/addquicktag/

  2. Frank
    Member
    Plugin Author

    Posted 1 year ago #

    The string Quicktags is current hard inside the javascript.
    But you can change it with a custom plugin and jquery

    var value = $("#content_rmnlQuicktagSettings_tmce_text").val(); // value = 9.61 use $("#text").text() if you are not on select box...
        value = value.replace("Quicktags", "something else string");

    If you will change the position of the button, then deactive my default filter and add new, also in the custom plugin.

    if ( ! class_exists( 'Add_Quicktag_2_TinyMce' ) )
            return NULL;
    
        remove_filter( 'mce_buttons_2',        array( 'Add_Quicktag_2_TinyMce', 'extend_editor_buttons' ), 10, 2 );
        add_filter( 'mce_buttons_4',        array( 'Add_Quicktag_2_TinyMce', 'extend_editor_buttons' ), 10, 2 );

    The number on the button-Hook is the line inside the editor.

    * I have not tested the source, but I think it works.

  3. Paul Thomson
    Member
    Posted 1 year ago #

    Hey Frank!

    Thanks for getting back to me so quickly.

    Having a little problem implementing your fixes, I've included both code snippets into a plugin and tried to activate but it says it triggers a fatal error...?

    Have I done something incorrectly? My plugin code:

    <?php
    /**
     * Plugin Name: QuickTags drop-down menu-reposition and change
     */
    
    var value = $("#content_rmnlQuicktagSettings_tmce_text").val(); // value = 9.61 use $("#text").text() if you are not on select box...
        value = value.replace("Quicktags", "something else string");
    
    if ( ! class_exists( 'Add_Quicktag_2_TinyMce' ) )
            return NULL;
    
        remove_filter( 'mce_buttons_2',        array( 'Add_Quicktag_2_TinyMce', 'extend_editor_buttons' ), 10, 2 );
        add_filter( 'mce_buttons_4',        array( 'Add_Quicktag_2_TinyMce', 'extend_editor_buttons' ), 10, 2 );
    
    ?>

    Thanks again for all your help,

    Regards,
    Paul

  4. Frank
    Member
    Plugin Author

    Posted 1 year ago #

    No.

    Check this.

    <?php
    	/**
    	 * Plugin Name: QuickTags drop-down menu-reposition and change
    	 */
    
    	if ( ! class_exists( 'Add_Quicktag_2_TinyMce' ) )
    		return NULL;
    
    	add_action( 'admin_footer-post-new.php', 'fb_change_quicktags_text' );
    	add_action( 'admin_footer-post.php', 'fb_change_quicktags_text' );
    	function fb_change_quicktags_text() {
    		?>
    		<script type="text/javascript">
    		jQuery(document).ready( function($) {
    			var value = $("#content_rmnlQuicktagSettings_tmce_text").val();
    			value = value.replace("Quicktags", "something else string");
    		} );
    		</script>
    		<?php
    	}
    
    	remove_filter( 'mce_buttons_2', array( 'Add_Quicktag_2_TinyMce', 'extend_editor_buttons' ), 10, 2 );
    	add_filter( 'mce_buttons_4',    array( 'Add_Quicktag_2_TinyMce', 'extend_editor_buttons' ), 10, 2 );
  5. Paul Thomson
    Member
    Posted 1 year ago #

    Hey Frank,

    Thanks for sending that through. I've put into a plugin and activated, and although there are no errors coming up the drop-down menu does not seem to have moved position, neither has it been renamed...

    Any ideas?

    Thanks,
    Paul

  6. Frank
    Member
    Plugin Author

    Posted 1 year ago #

    Sorry, is it not so easy. WP init all this dynamicly and render the buttons. Also the string: I think the plugin is to early, why WP render the strings.

  7. Paul Thomson
    Member
    Posted 1 year ago #

    Hey Frank,

    So does that mean there is no solution to this problem?

    Regards,
    Paul

  8. Paul Thomson
    Member
    Posted 1 year ago #

    Hey Frank,

    No worries, I've just done core edits to plugin files and will do this on each update, changes made for other people who wish to do the same:

    /inc/class-tinymce.php - Changed line 49 from mce_buttons_2 to mce_buttons_4
    /inc/tinymce/editor_plugin.js - Changed line 10 from Quicktags to Whatever you want

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.