Ready to get started?Download WordPress


Show gallery based on post tag (2 posts)

  1. mariostella
    Posted 5 years ago #

    Hi, I need to write a query to be able to show the gallery associated with a post only if that post has a specific tag.

    I would need some thing like:
    php query

    code that shows the gallery

    end of php query

    is it possible?

  2. mariostella
    Posted 5 years ago #

    My current query is as such:

    $tags = 'show-gal'; // separate multiple tags with comma
    $myquery = new WP_Query("tag=$tags");?>
    <?php if($myquery->have_posts()) : ?>
                    Do my stuff
    <?php endif; ?>

    But it's not working.

    Anyone on this?

Topic Closed

This topic has been closed to new replies.

About this Topic