Support » Themes and Templates » Link to taxonomy page that loads correct template and query_string

  • sebastianmauchly


    The setup
    So I have a custom taxonomy called ‘playlists’, with the terms “chillin”, “smooth jazz”, “rave”, etc. Obviously, each new term in the ‘playlist’ taxonomy represents a new playlist that I want to make.

    I also have a custom post type called ‘playlist_song’ which is associated with the ‘playlists’ taxonomy. Each new ‘playlist_song’ post represents just one song in just one of the playlists.

    I want to display all posts of type ‘playlist_song’ that are tagged with the same ‘playlist’ term together. All playlist_songs tagged with “rave” on one page, all playlist_songs tagged with “chillin” on another, etc. Then I will create a taxonomy-playlists.php template file that gives WordPress a general layout for displaying each of these pages (rather than a specific template for each one, like taxonomy-playlists-rave.php).

    The Immediate Problem
    I want to make a nav-bar menu item that is a Playlists page. The idea is that you click on the Playlists page in the nav-bar, and that brings you to a Playlists page with all of the different playlists listed. That is, I want a page with links to all of the taxonomy term pages. To be clear, there are no songs on this page. It is an intermediate page that lets you pick which playlist you want to stream.

    I want full css/html level control over these links. How do I form a link that correctly forms the query-string and loads the taxonomy template? Can I do it without the gimmicky tag_cloud? Please?

    Deeper General Question
    Notice that in the more familiar domain of categories, a page that displays all items of a given category already exists. You simply add a category to the menu, and now your site has a link to a page that loads the category template and forms a query string that correctly populates that template. I can do the same with taxonomies, adding a taxonomy to the menu which becomes an appropriate link on the site.

    But how do I make one of those links from scratch? Can’t you create a more custom page type that has its own type of query and template? Maybe I don’t want exactly the type of query that taxonomies provide, but I also don’t want to manually create an actual page, apply the correct template and force a second different query.

    TL;DR: Isn’t there a way to make a link that just picks one of my own templates, and then forms my own custom query_string that isn’t immediately replaced by a new query called in the template?

  • The topic ‘Link to taxonomy page that loads correct template and query_string’ is closed to new replies.