Forums

Dynamic Sidebar Menu with Custom Fields? (1 post)

  1. ashnewmedia
    Member
    Posted 1 year ago #

    Hi I am trying to make a menu that is the children pages of a parent level page and it works with the following code:

    <?php
    		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");
    		if ($children) { ?>
    			<ul>
    		<?php echo $children; ?>
    		</ul>
    	<?php } ?>

    So I get:

    Page 1
    Page 2
    Page 3

    BUT, I wanted to add a brief description using Custom Field meta data I created called "navigational_abstract" from each page so that I would have something like:

    Page 1
    This is the first page
    Page 2
    This is the second page
    Page 3
    This is the third page

    I thought I could do something like this(after echo $children):

    <?php echo get_post_meta($post_id=$children->post->ID, navigational_abstract, true); ?>

    but it's returning no results.

    Is this even possible with the get_post_meta()? The other thought I had was to get "wp_list_pages" to return the ID values in an array but I am relatively new to WordPress PHP. Any help would be appreciated.

    Ash

Topic Closed

This topic has been closed to new replies.

About this Topic