Support

Account

Forum Replies Created

  • Update: I figured out that it’s a problem with the content and not with the code. All of the articles that have the issue custom field – the data was all imported from another website. Something must have happened during the import process in the database where even though the article had a particular issue associated with it through that relationship field, the value still wasn’t being recognized.

    Once I start going through articles and updating the fields, the code worked properly. So it’s not a problem on the code end, it’s with the data. At least the code we’re using, which is what we determined above, is working fine.

    Thanks for the help!

  • That’s working – the ID is successfully being output.

  • I tried that and it still didn’t work. Specifically, I added…

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    ...
    
    <?php endwhile; endif; ?>

    …around the whole thing.

  • `<?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(); ?>

  • It’s a relationship field, set to return format of post IDs.

Viewing 5 posts - 1 through 5 (of 5 total)