WordPress.org

Ready to get started?Download WordPress

Forums

Calling WP_Query does return a Post, but not the Tags (2 posts)

  1. bertac
    Member
    Posted 5 years ago #

    Hello,

    My index.php looks like this (irrelevant HTML skipped):

    $myPosts = new WP_Query('category_name=xxxxxx&showposts=3&order=DESC');
    $myPosts->the_post();
    print "<h1>" . get_the_title() . "</h1>";
    print get_the_tags('<p class="tags"><strong>Tags: </strong>', ' | ', '</p>');

    My problem is that the title is returned, but the tags are not.

    I have read the file query.php but cannot find a clue where to look for a solution. I hope this is not too much a newbie question.

    Thanks for your help.
    Regards,
    Bert

  2. roya khosravi
    Member
    Posted 5 years ago #

    because get_the_tags returns an array.

    please read this : http://codex.wordpress.org/Template_Tags/get_the_tags

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags