Moderator
t-p
(@t-p)
Am I missing something here? I had already checked that page in the codex and couldn’t see a parameter that I could leverage to query post titles.
This is the loop I have nested on the page to call in posts from another post type, but at the moment it’s missing an extra parameter to restrict it to posts that share the same string in the title as the current page:
<?php $track_query = new WP_Query( "post_type=tracks" );
if ( $track_query->have_posts() ) { ?>
<ul>
<?php
while ( $track_query->have_posts() ) {
$track_query->the_post();
// post stuff here
} ?>
</ul>
<?php } wp_reset_postdata(); ?>
Moderator
t-p
(@t-p)
I can,t tell what’s missing. Sorry.
Well the first line is only using the post_type parameter. I need it to use this AND also constrain the results to a specific title string. E.g.
$thetitle = the_title();
$track_query = new WP_Query( "post_type=tracks&post_title=$thetitle" );
The thing is, ‘post_title’ isn’t a valid parameter. I was wondering if there’s a clever way around this?
Instead of $thetitle = the_title();
try
$thetitle = get_the_title();
the_title() has a permalink embedded inside of it, where as get_the_title() is just a string.
Thanks for the tip JackdUpFord, that’s useful. Unfortunately I still dont have a way to plug it into the query…
I also need to query by the post title velocity. Have you found any answers yet?