I have multiple Wordpress custom post types set up using Toolset Types, with the following names:
no-9
no-8
no-7
etc.
I would like make a Wordpress query to show the posts from one of these custom post types on another page. The page I would like to show the posts on, also contains a custom field with the name 'issue-no' that matches the name of the custom post type I would like to show.
What I have for my query so far is:
<?php
query_posts(array(
'post_type' => 'no-9',
) );
?>
<?php while (have_posts()) : the_post(); ?>
<h2><?php the_title(); ?</h2>
<?php endwhile;?>
This works to show all posts from the post type 'no-9', however I would like the call to be dynamic so it can update based on the matching custom field 'issue-no'.
How can I call the custom field name/meta key in the query? Something like below in theory, however it doesn't put the custom field into the query.
<?php
query_posts(array(
'post_type' => 'wpcf-issue-no',
) );
?>
<?php while (have_posts()) : the_post(); ?>
<h2><?php the_title(); ?</h2>
<?php endwhile;?>