WordPress.org

Forums

[resolved] How to get different single.php page for posts from different categories? (2 posts)

  1. Nessdufrat
    Member
    Posted 1 year ago #

    So, the problem is quite simple, not sure the answer will be.
    I'm designing a website which will have different sections, more or less separated from each other.
    I'm using templates with custom headers to style the pages differently. I'm using a custom query in the main loop to exclude posts from some categories from the front page. I'm using a custom loop to get these excluded categories to show on another section of my website.
    So far so good... until I click a post. Which, of course, is calling single.php, and I can't style it differently (I would need a whole different header, etc.). What I'd like to do is to have my custom loop (right now, loop-level3.php) call a single-level3.php file when somebody clicks on a post belonging in this section.
    I've read about custom post types, it doesn't really seem the way to go. I don't need anything specific about the posts, like special features and such, I just need my loop-level3.php to call a special single-level3.php page.
    Is something like that possible? I browsed through the codex and forums, I found lost of topics where people want to change a few minor things (I've done a whole website where each category is styled differently, each post is also styled according to the category, but it didn't involve a new header file), but I haven't found anything like what I need.
    Any advice on how to proceed?
    Thanks :)

  2. Nessdufrat
    Member
    Posted 1 year ago #

    Never mind, I think I found it, I was looking at it the wrong way. I'll work on it and post my solution here so that if somebody looks for the same thing, they'll find it easily.

    Perfect solution here: http://wordpresshero.com/tricks/different-single-post-pages-in-wordpress.html/
    Or here: http://wordpress.org/support/topic/posts-in-multiple-categories-different-singlephp?replies=2

    A different way of doing it: http://wordpress.stackexchange.com/questions/69928/posts-in-multiple-categories-different-single-php

    Can't understand why I didn't find them at first. Anyway, problem solved, sorry.

Topic Closed

This topic has been closed to new replies.

About this Topic