Support

Account

Home Forums Front-end Issues Display Post by Tag with ACF Field

Solved

Display Post by Tag with ACF Field

  • Hi,
    I tried fetching the posts by tag, but I couldn’t figure out how.

    It will display the posts when I use this method.

    <?php
     $postslist = get_posts('numberposts=5&orderby=date&tag=mirpurkhas');
     foreach ($postslist as $post) :
        setup_postdata($post);
    ?>
    
    <?php the_title(); ?><br>
    <?php endforeach; ?>

    The posts are displayed, but not the exact tag posts when I use this.

    <?php
     $jobtag = get_field('job_tag');
     $postslist = get_posts ('tag='.$jobtag.'&posts_per_page=5&orderby=date');
     foreach ($postslist as $post) :
        setup_postdata($post);
    ?>
    
    <?php the_title(); ?><br>
    <?php endforeach; ?>
  • To display these posts, I am using the Custom TaxonomyTemplate.

  • I noticed that the custom Taxonomy Template does not display any of the fields.

  • Never mind, I have deleted the custom taxonomy template and am not using it anymore. Thanks

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

You must be logged in to reply to this topic.