Custom Fields and SideNav
-
Okay,
I am new to WordPress and I am having problems showing only specific pages in the SideNav.
I have created a CUSTOM FIELD called sidenav and set the value of that field to 1 on the pages I want to appear in the SideNav.
Pages that have a value of 0 will appear in my TopNav.
This code below queries and returns all of my pages. How do I get it to only return items where my CUSTOM FIELD sidenav has a value of 1.
<?php
// get the meta value for the key ‘foo’
$Cluster = get_post_custom_values(‘sidebar’);// make sure that worked
// print_r($Cluster); // I’m ok here, so far// if $Cluster not null, list the Pages with the custom key ‘foo’ and the value ‘bar’ THIS IS WHERE IT DOESN’T WORK:
if ($Cluster !== ”) {echo ‘<div class=”article_links”>
<h2>Side Nav</h2>-
‘;
wp_list_pages($Cluster);echo ‘
</div><!– .article_links –>’;
}
?>Thanks in Advance
- The topic ‘Custom Fields and SideNav’ is closed to new replies.