WordPress.org

Ready to get started?Download WordPress

Forums

anchor button? (8 posts)

  1. Jenn65B
    Member
    Posted 3 years ago #

    I am using TinyMCE Advanced as my editor. I was told there would be an anchor option in the "link" button, however I do not see where that is? Do I need a special plugin to anchor some text?

  2. Jenn65B
    Member
    Posted 3 years ago #

    No one can help me with this? Then how do people create anchors to text with this wordpress program? I'm new using this and I was told Tinymce Advanced was the plugin to use. However, when I click the spot where I want the anchor to be, then click the anchor button and type in the name, nothing appears (should be an anchor box, I'd think) after clicking to insert. I'm us wordpress 3.2.1.

  3. Jason Lemahieu (MadtownLems)
    Member
    Posted 2 years ago #

    add_action("admin_init","tinymce_mods_buttons_setup");
    
    function tinymce_mods_buttons_setup() {
    	//only if editing permissions do we bother
    	if (!current_user_can('edit_posts') && !current_user_can('edit_pages')) return;
    
    	if ( get_user_option('rich_editing') == 'true') {
    		add_filter('mce_buttons', 'tinymce_mods_add_buttons');
    	}
    }
    
    function tinymce_mods_add_buttons($buttons) {
       array_push($buttons, "anchor");
       return $buttons;
    }

    however, I found your post because it isn't working 100% correctly unfortunately. You'll get the Anchor button, which produces a dialog box when clicked, which adds the Anchor to the html - but the Anchor icon in the visual editor isn't displayed

  4. Jenn65B
    Member
    Posted 2 years ago #

    Thank you for your reply! I guess I'm too new at this because I'm not sure where to add what you wrote?! Is there another editor or plugin that will do anchors in the visual editor?

  5. Jason Lemahieu (MadtownLems)
    Member
    Posted 2 years ago #

    This could just get plopped into your functions.php

    but like I said, note the one issue - that after adding the anchor in the Visual Editor, you won't be able to see it there (without switching to html view)

  6. sunriseweb
    Member
    Posted 2 years ago #

    Here's how I did it (can't remember where I found this). The anchor is visible in the editor using this method.

    Add the following code to functions.php for your theme.

    function enable_more_buttons($buttons) {
      $buttons[] = 'hr';
      $buttons[] = 'anchor';
    
      /*
      Repeat with any other buttons you want to add, e.g.
    	  $buttons[] = 'fontselect';
    	  $buttons[] = 'sup';
      */
    
      return $buttons;
    }
    add_filter("mce_buttons", "enable_more_buttons");
  7. Jenn65B
    Member
    Posted 2 years ago #

    when I plopped that into functions.php I got this. Why?

    function enable_more_buttons($buttons) { $buttons[] = 'hr'; $buttons[] = 'anchor'; /* Repeat with any other buttons you want to add, e.g. $buttons[] = 'fontselect'; $buttons[] = 'sup'; */ return $buttons; } add_filter("mce_buttons", "enable_more_buttons");
    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/99/7000499/html/wp-content/themes/2010-weaver/2010functions.php:505) in /home/content/99/7000499/html/wp-content/plugins/si-contact-form/si-contact-form.php on line 2075

    Warning: Cannot modify header information - headers already sent by (output started at /home/content/99/7000499/html/wp-content/themes/2010-weaver/2010functions.php:505) in /home/content/99/7000499/html/wp-admin/theme-editor.php on line 103

  8. sunriseweb
    Member
    Posted 2 years ago #

    Hmmm... I'm guessing it is a syntax error in the copy and paste due to the comment section. Try removing the comments in the function and just put in.

    function enable_more_buttons($buttons) {
      $buttons[] = 'anchor';
      return $buttons;
    }
    add_filter("mce_buttons", "enable_more_buttons");

    If that's not it then maybe it is a conflict with the si-contact-form plugin?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.