Blog

How to create a sidebar navigation in Wordpress

Here’s a snippet that will give you an instant sidebar navigation in Wordpress. It grabs the post parent title and the children of that parent.

Download wordpress-sidebar-nav.txt

< ?php
$parent_title = get_the_title($post->post_parent);
$permalink = get_permalink($post->post_parent);
if($post->post_parent) {
$children = wp_list_pages('title_li=&child_of='.$post->post_parent.'&echo=0');
}
else {
$children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
}
?>

< ?php if ($children): ?>


< ?php endif; ?>

Related posts:

  1. How to Create Books in Coda
  2. How to create a CSS3 border fadeout
  3. How to change the default jQuery version used by WordPress

Comment on this article:

  • Blog Home