include pages when meta_value = page title?
-
Hi,
I’m trying to create a ‘related pages’ navigation and I need to include pages that have a custom field value equal to the page title.
I’ve used this code, but it doesn’t work properly – please can someone help?
<?php global $post; $args=array( 'post_type' => 'page', 'meta_key' => 'Project Group', 'meta_compare' => '=', 'meta_value' => 'the_title();' ); $pages = get_posts($args); if ($pages) { $pageids = array(); foreach ($pages as $page) { $pageids[]= $page->ID; } ?> <ul> <?php wp_list_pages('include='.implode(",", $pageids)); ?> </ul> <?php } ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘include pages when meta_value = page title?’ is closed to new replies.