Forum Replies Created

  • OK so I wasn’t getting formatted content so I came up with this – works as expected so I assume its fine ?

    $content = apply_filters('the_content', get_post($post->ID)->post_content);

  • Whilst that didn’t work simply echo the_content(); did – must of been overthinking it.

    Many thanks for your help

  • Of course. Got that working.

    How can I output the post content (main text area) rather than just the permalink?

  • The code is in the single template file for the cpt.

    Your suggestion got the custom field working (the_field(‘test’) but the permalink and the title aren’t returning anything – specifically I need the title and the post content.

    Many thanks for your help

  • Oh you are too cool my friend! Makes perfect sense. Thanks a billion.

  • I really appreciate your help John.

    Unless I have misunderstood, the above doesn’t work. I feel like the if statement needs be before echoing out the category name, else it will continue to echo out regardless of whether it has posts.

    function honour_roll_loop() {
        //Args for Categories
    	$args = array(
        'orderby'           => 'id', 
        'order'             => 'ASC',
         echo "<h1>" . get_the_title() . "</h1>";
        $terms = get_terms("category",$args);
        $count = count($terms);
    if ( $count > 0 ){
        foreach ( $terms as $term ) {
            echo '<h2>' . $term->name . '</h2>';
            echo '<table>';
           $loop = new WP_Query( array( 
                'post_type' => 'recipient',
                'post_per_page' => 100,
                'meta_key' => 'year',
                'orderby' => 'meta_value_num',
                'order' => 'DESC',
                'tax_query' => array(
                        'taxonomy' => 'category',
                        'field' => 'id',
                        'terms' => $term->term_id
                meta_query => array(
                        'key' => 'year',
                        'value' => '2008'
            // the loop
            while ($loop->have_posts()) : $loop->the_post();
    		$year = get_post_meta(get_the_ID() , 'year', true); //custom field
            $org = get_post_meta(get_the_ID() , 'recipient_organisation', true); //custom field
            $awarded = get_field_object('field_564bc3aa81a9f');
                // do loop content
                echo '<tr>';
                echo '<td>' . $year . '</td>';
                echo '<td>' . $awarded['value'] . '</td>';
                echo '<td>' . get_the_title() . '</td>';
                echo '<td>' . $org . '</td>';
                echo '</tr>';
            // reset $post so that the rest of the template is in the original context
            echo '</table>';
  • One more question … please

    How would I incorporate an if statement in there so that if there were no posts for the term, it would not print out.

    many thanks

  • Oh thank you so much. You’re a life-saver.

    I had tried that, but had missed out the comma after the tax-query.

  • ah yes, I have it now. I’d only installed the gallery portion of the pro plugin and not the whole thing.


  • That just gives me a drop down list to select an internal page. I want an external link.

  • Whilst certainly no expert, I couldn’t get the_field to work in a WP-Query, so I used this instead:

    $name = get_post_meta(get_the_ID() , 'your_name', true); //custom field

    then just echo $name

  • I thought I had this – I’m sure I’m close but it doesn’t work

    if( $images ): ?>
            <ul class="slides">
                <?php foreach( $images as $image ): ?>
                       <?php $image_url = $image['url']; ?>
                        <?php $content="<img src='$image_url' />"; ?>
    					<?php if ( function_exists('slb_activate') ) ?>
        				<?php $content = slb_activate($content); ?>
    					<?php echo $content; ?>
                        <p><?php echo $image['caption']; ?></p>
                <?php endforeach; ?>
    <?php endif;
  • Did you find an answer to this?

    I don’t understand how to apply the slb_activate() also. My code is very similar to the above.

  • Is there some other way I can get pre-purchase support?

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