WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Page Tags Query in Only One Subdirectory (5 posts)

  1. cscarnevale
    Member
    Posted 8 months ago #

    Does anyone know how to make a list of pages with a certain tag, but only in one subdirectory? I found the following two examples of codes to help me get there, but I don't know how to make the query display only results from a certain subdirectory (i.e. example.com/plants and only pages under the plants subdirectory show up in the query results).

    http://stackoverflow.com/questions/32341/how-do-i-list-all-entries-with-a-certain-tag-in-wordpress

    and

    http://digwp.com/2010/01/custom-query-shortcode/

    Does anyone have any thoughts on this?

    Thanks.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 8 months ago #

    but only in one subdirectory

    WordPress doesn't use subdirectories? Can you be a little more specific?

  3. cscarnevale
    Member
    Posted 8 months ago #

    Maybe I mean subpages.

    i.e.

    -example.com
    -example.com/plants
    -example.com/plants/plant1
    -example.com/plants/plant2

    I want to specify in my query to only pull results from subpages under "plants."

    Does this make sense?

    I also found this plugin "List Pages Shortcode" that looks perfect if I could tweak it to output subpages with a certain tag:

    http://wordpress.org/support/plugin/list-pages-shortcode/

  4. esmi
    Theme Diva & Forum Moderator
    Posted 8 months ago #

    Have a look at the post_parent parameters.

  5. cscarnevale
    Member
    Posted 8 months ago #

    Yes! post-parent parameters did it! Thank you. I used the plugin Shaun's WP Query Shortcode to place the list within my page, then I set the tag and post_parent parameters.

    For example, after installing Shaun's WP Query Shortcode, I just entered:

    [wpquery tag=nitrogen-fixer post_parent=2] [wpq_index] [/wpquery]

    Where "nitrogen-fixer" was my tag and "2" was my parent page of which I wanted to display the child pages.

    Thanks!

Reply

You must log in to post.

About this Topic