• Resolved jageo

    (@jageo)


    I’ve tried googling this, but honestly not even sure how to phrase the question, so not easy to find the right posts to read ??
    I built a competition web site. The judge logs in and views the posts (the entries) in that category. The category template shows the judge several fields about each post, things they need to read as they are judging the entry. And using a front end plug-in, they can add some notes and mark results, right there on the category template.
    BUT i would ALSO like them to be able to view that category in a different layout. One that just lists the post title and the results custom field. Perhaps they would get to that template by clicking a link at the top of the default template, that would bring them to the alternate template.
    Any thoughts? Suggestions about how to word a google search to find appropriate solutions?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter jageo

    (@jageo)

    Thinking this through… either i send them to a different template (like send them to the archive.php?) or I stay with the same category.php template, but put a variable in the URL for a GET statement to pick up, and a simple If/Else decides what happens on the category.php page? Is that a real thing?

    Moderator bcworkz

    (@bcworkz)

    Almost anything can be a real thing if you’re willing to custom code it ?? While you can have different templates for different categories, not two for a single category, at least not by default. I can think of a couple options to get around this. One is as you suggest: include an URL query string that’s checked in a callback added to the “template_redirect” action. If the value is present, load the alternative template. Otherwise do nothing and let WP do what it normally does.

    The other is to develop a custom page template that queries for and displays posts in that category as you desire. Any varying information the page needs to display the right posts can be passed as an URL query string.

    Thread Starter jageo

    (@jageo)

    thank you @bcworkz , the custom page template sounds useful.
    I also came up with building content tabs on the category page. There isn’t a style built into my theme, so i have to work to make it look like it belongs there, but its nice for the user not to have to refresh the whole page. I suppose the down-side to this one is the page has more code to load and process.
    thanks again

    Moderator bcworkz

    (@bcworkz)

    You’re welcome. Yes, tabs are more to process, but if the user is likely to want to see multiple tabs anyway, they save additional server requests.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘can there be two category templates where user can choose between?’ is closed to new replies.