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

  1. cscarnevale
    Posted 1 year 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).




    Does anyone have any thoughts on this?


  2. esmi
    Forum Moderator
    Posted 1 year ago #

    but only in one subdirectory

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

  3. cscarnevale
    Posted 1 year ago #

    Maybe I mean subpages.



    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:


  4. esmi
    Forum Moderator
    Posted 1 year ago #

    Have a look at the post_parent parameters.

  5. cscarnevale
    Posted 1 year 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.


Topic Closed

This topic has been closed to new replies.

About this Topic