Forums

cant able to edit nofollow code in functionslistpages (3 posts)

  1. sony120
    Member
    Posted 5 months ago #

    i want to nofollow contact us, about us, privacy policy and disclaimer pages that are in the navigation bar.

    as this is the code in the function_list_pages_flat()

    // Add post ID to nofollow separated by comma
    $nofollow_posts = array(1, 2);
    
    if ( in_array( $page->ID, $nofollow_posts ) )
    	$nofollow = ' rel="nofollow"';
    else
    	$nofollow = '';
    
    $output .= $indent . '<li class="' . $css_class . '"><a '. $nofollow . 'href="' . get_page_link($page->ID) . '" title="' . attribute_escape(apply_filters('the_title', $page->post_title)) . '"><span>' . apply_filters('the_title', $page->post_title) . '</span></a></li>';

    where to exactly add the contact us, about us, privacy policy and disclaimer page urls and the page IDs for these four pages.

    My PHP/CSS knowledge is quite limited.

  2. SwansonPhotos
    Member
    Posted 5 months ago #

    I think the 'rel=nofollow' should be applied to the href, not the a tag.

    Correct this for other reasons also such as proper syntax:

    $output .= $indent . '<li class="' . $css_class . '"><a '. $nofollow . 'href="' . get_page_link($page->ID) . '" title="' . attribute_escape(apply_filters('the_title', $page->post_title)) . '"><span>' . apply_filters('the_title', $page->post_title) . '</span></a></li>';

  3. sony120
    Member
    Posted 5 months ago #

    Thanks for your reply, as My PHP/CSS knowledge is quite limited.

    can you please provide more information on
    where to exactly add the contact us, about us, privacy policy and disclaimer page urls and the page IDs for these four pages in the code given by you.

    Thank you

Reply

You must log in to post.

About this Topic

Tags