Try:
$this_page_title = the_title();
args=array(
'post_type' => 'page',
'meta_key' => 'Project Group',
'meta_value' => $this_page_title
);
Thread Starter
Duncan
(@jamodu)
Thanks for the reply esmi but I’m afraid that still doesn’t work 🙁
$this_page_title = the_title();
@args=array(
'post_type' => 'page',
'meta_key' => 'Project Group',
'meta_value' => $this_page_title
);
Thread Starter
Duncan
(@jamodu)
Finally sorted. It needed to be get_the_title rather than just the_title…
<?php
$this_page_title = get_the_title();
global $post;
$args=array(
'post_type' => 'page',
'meta_key' => 'Project Group',
'meta_compare' => '=',
'meta_value' => $this_page_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
}
?>
Hope that helps someone else in the future.