Hi!
I'm trying to set up a page template with a custom query that uses the page title to pull posts from the DB where the current page title matches a custom field value.
In other words, when you visit the page "blue" it will display all posts where custom field "color" is blue.
The query works when I type the title but doesn't work with the template tag or var like the following example:
<?php
$title = the_title();
$query = 'post_type=any&meta_key=color&meta_value='. $title .'&order=DESC';
$queryObject = new WP_Query($query);
while ($queryObject->have_posts()) : $queryObject->the_post();
?>
Any idea what might be wrong or any way to solve this?
Thanks!
Ricardo