How To Add Private Pages In Navigation Menu Of WordPress Blog

Posted by

Hi,

If you are using private pages and want to display then in navigation menu then use this hack. For that open the file where your navigation code is and add this code:

<ul>
<?php
wp_list_pages(‘depth=1&title_li=0&sort_column=menu_order’);
if(current_user_can(‘read_private_pages’)) :
?>
<li><a href=”<?php echo get_permalink(10); ?>”>For Authors only</a></li>
<?php endif; ?>
</ul>

Now, navigation menu displays private pages when specific user is login into blog.

That’s it!

Thanks,

Shane G.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.