The MU forums have moved to WordPress.org

Changing edit link on MU Admin Bar (4 posts)

  1. DailyTestimony
    Member
    Posted 16 years ago #

    I have the MU Admin Bar plugin, which I have already slightly modified to have a transparent background and have modified my themes to accomidate it.

    Right now I am trying to add a new condition to display the edit link. I want it displayed for all posts and pages except the one with ID 23, this is the modified code

    # Special case for edit
    		if (is_single() || is_page())  {
    			if( $post->post_type == 'page' ) {/* added by drmike to fix page edit */
        		                $file = 'page';
    	                } else {
        		                $file = 'post';
    		        }
                            if (!$posts[0]->ID == '23') {
                                    $edit_array = array('<strong>'.__('Edit').'</strong>', array('edit_post', $posts[0]->ID), 'post.php?action=edit&amp;post='.$posts[0]->ID, 'edit-link');
                            }
                    }

    I added the if (!$posts[0]->ID == '23') { but it seems nothing passes this if statement,the edit link doesn't display on any page or post now. I have echoed $posts[0]->ID and it does hold the correct id.

    Any ideas?

  2. andrea_r
    Moderator
    Posted 16 years ago #

    Since the MU admin bar shows on ALL blogs, to query posts, you'd have to grab the blog id as well.

    Seriously if you want the edit link to show up on posts & pages, put it in the themes where it should be.

  3. lunabyte
    Member
    Posted 16 years ago #

    if (!$posts[0]->ID == '23') {

    In correct syntax.

    if ($posts[0]->ID != '23') {

    Provided $posts[0]->ID actually contains an ID, etc.

  4. DailyTestimony
    Member
    Posted 16 years ago #

    heh works luna...

    I've also made it more specific per what andrea_r mentioned to make sure its only on the main blog

    if ($posts[0]->ID != '23' || get_current_site()->id != '1') {

    I also added a forum admin link to page 23 in the main blog in lue of the edit link using

    if (get_current_site()->id == '1' && is_site_admin() && $posts[0]->ID == '23') {

About this Topic

  • Started 16 years ago by DailyTestimony
  • Latest reply from DailyTestimony