Home › Forums › Front-end Issues › Problem Using Relationship Field & CPT Query › Reply To: Problem Using Relationship Field & CPT Query
`<?php get_header(); ?>
<?php include( TEMPLATEPATH . ‘/includes/red-bar.php’ ); ?>
<div class=”container-fluid content”>
<div class=”row-fluid”>
<p class=”breadcrumbs”><span xmlns:v=”http://rdf.data-vocabulary.org/#”><span typeof=”v:Breadcrumb”><a href=”<?php bloginfo(‘siteurl’); ?>” rel=”v:url” property=”v:title”>Home</a> » <span><a href=”<?php bloginfo(‘siteurl’); ?>/get-informed/”>Get Informed</a></span> » <span><a href=”<?php bloginfo(‘siteurl’); ?>/get-informed/dispatch-from-jerusalem/”>Dispatch from Jerusalem</a></span> » <span class=”breadcrumb_last”><?php the_title(); ?></span></span></span></p>
<?php do_action(‘addthis_widget’,get_permalink($post->ID), get_the_title($post->ID), ‘above’); ?>
</div>
<div class=”row-fluid dispatch-issue”>
<div class=”span3″>
<?php the_post_thumbnail(); ?>
<p class=”e-dispatch”><a href=”<?php echo the_field(‘external_url’); ?>” target=”_blank”>View e-Dispatch</a></p>
</div>
<div class=”span9″>
<h1><?php the_title(); ?></h1>
<?php
// args
$args = array(
‘post_type’ => ‘article’,
‘meta_query’ => array(
array(
‘key’ => ‘issue’,
‘value’ => ‘”‘ . get_the_ID() . ‘”‘,
‘compare’ => ‘=’
)
)
);
// get results
$the_query = new WP_Query( $args );
// The Loop
?>
<?php if( $the_query->have_posts() ): ?>
<ul>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<li>
<a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<?php wp_reset_query(); // Restore global post data stomped by the_post(). ?>
</div>
</div>
<?php include( TEMPLATEPATH . ‘/includes/explore-subjects.php’ ); ?>
</div>
<?php get_footer(); ?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.