Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'd like to use the wp_list_pages as a navigation bar, but I don't want the links to be followed. This is the simple version of the code I'm using <?php wp_list_pages('hierarchical=1&title_li=&depth=1'); ?> but I have no idea how to add the "nofollow" to the links.

share|improve this question

1 Answer 1

use wordpress build in funcion for that "wp_rel_nofollow" with a hook to wp_list_pages.

paste this code in your theme's functions.php file and you are set.

function add_no_follow($output){
  return wp_rel_nofollow($output);
}
add_filter('wp_list_pages', 'add_no_follow');

hope this helps.

share|improve this answer
    
I think this will nofollow all wp_list_pages links on my site. I'm using this code for different purposes (to list different groups of pages) and I don't want all of them no-followed, just the links in my nav-bar. –  user2716 Jan 25 '11 at 12:00
2  
@Zmey: You can disable echo for wp_list_pages(), give the output to wp_rel_nofollow(), and echo the result of that. –  Jan Fabry Jan 25 '11 at 12:12
    
Of course, thanks a lot! –  user2716 Jan 25 '11 at 12:20
    
@Zmey - If you've found a solution with the information provided, please be sure to mark this as the correct answer. –  t31os Jan 26 '11 at 14:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.