WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Sidebar Menu
[resolved] Help! Can't get this to work (3 posts)

  1. webrightnow
    Member
    Posted 11 months ago #

    Needing some help here.

    I can't get the widget to display where I would expect it to.

    I would like to use this plugin to display a sidebar menu on any pages that have child pages. The menu should only show a list of each page's children. From the description it seems this should be possible. I have created a page, then a child page, then activated the widget but nothing shows up on either the parent or child page. I have tried all the settings, including changing the levels etc. but so far nothing works. I got it to show up in posts, but even then it's only showing a link to the category but not the actual posts, which is what I need.

    Is this possible? Ideally I'd prefer to use it with pages, not posts. Thanks.

    http://wordpress.org/plugins/advanced-sidebar-menu/

  2. webrightnow
    Member
    Posted 11 months ago #

    Actually I managed to do what I was after in a much simpler way. I dropped this bit of code into sidebar.php:

    <?php
    	if($post->post_parent)
    		$children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->post_parent."&echo=0");
    	else
    		$children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->ID."&echo=0");
    	if ($children) { ?>
    		<ul id="subnav">
    			<h3>My subpages</h3>
    			<?php echo $children; ?>
    		</ul>
    <?php } ?>

    Works great. I'd still like to know if this plugin would have achieved the same thing.

    BTW thanks to kriesi.at for the code.

  3. webrightnow
    Member
    Posted 11 months ago #

    Sorry, that should read:

    <?php
    	if($post->post_parent)
    		$children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->post_parent."&echo=0");
    	else
    		$children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->ID."&echo=0");
    	if ($children) { ?>
    		<h3>My subpages</h3>
    		<ul id="subnav">
    			<?php echo $children; ?>
    		</ul>
    <?php } ?>

    to avoid HTML errors.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.