• Resolved apatheticresistance

    (@apatheticresistance)


    Hi, thanks in advance to any help I can get!

    I’ve set up a Page that uses a Custom Template. In order to show the Page’s content, as well as a listing of Posts, I have two Loops on the Custom Template.

    The first Loop is normal, and only displays the Page’s content.

    The second Loop I constructed using an example from the Codex:

    <?php $my_query = new $wp_query('cat=-1&tag=video'); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <?php global $more;
    $more = 0; ?>

    The second Loop shows posts, and I want to have assorted meta-data as well as the post content. Categories, author name, all of it shows up BUT not the tags. At least, not using the_tags();

    I’ve tried limiting the wp_query to a certain tag, and it worked, so the Loop seems to recognise the tags that the posts have.

    I also tried this, without any luck.

    <?php if(get_the_tags()) $posttags = get_the_tags();
    if ($posttags) {
    foreach($posttags as $tag) {
    echo $tag->name . ' ';
    }}

    If anyone knows why the tags are not being output, I would love to hear about it! Thanks,
    Trevor

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘the_tags does not output content in wp query’ is closed to new replies.