WordPress.org

Ready to get started?Download WordPress

Forums

Archive pages for each custom taxonomy term (2 posts)

  1. cma7164
    Member
    Posted 1 year ago #

    Hello everyone,

    I am working on a project, where I have a custom post type and a custom taxonomy for that post type. I want to be able to view an archive of posts for each of the taxonomy terms, and the terms children. Like the standard category functionality. So for example if I have TermA with children TermA-1 and TermA-2. I'd like to be able to see all the posts that re within TermA, but to also be able to filter and see only the posts within TermA-1.

    Right now I have the following to query my posts, but this shows all the posts with the post type. Is there a way to alter this to meet my needs?

    query_posts('post_type=job-listings&post_status=publish&posts_per_page=10&paged='. get_query_var('paged'));
    if( have_posts() ):
      while( have_posts() ): the_post();
        the_title();
        the_content();
      endwhile;
    else:
       _e('None found.','example');
    endif;
    wp_reset_query();

    It doesn't seem like this should be overly complicated as I just want this taxonomy to work the same way that categories work by default.

    Any suggestions would be greatly appreciated!
    Thanks!

  2. lonchbox
    Member
    Posted 11 months ago #

    You can use taxonomy-[tax-name].php for all or taxonomy-[tax-name]-[term-name].php for each term.

Topic Closed

This topic has been closed to new replies.

About this Topic