• jberglund

    (@jberglund)


    Hey all!
    I don’t have a ‘theme’ to release, yet. Not sure if I’ll have time to do that for a while. But, I wanted to show off the working ‘category templates’ on my site.

    After many questions and lots of reading through the codex, I compiled much of what I heard and read and finally figured it out. Thanks to everyone who gave me some tips and leads.

    Moshu – If you still want the code on how to set this up, let me know. I can send you the code.

    http://www.jbergdesign.com

    So far, I’m only doing 5 of the 9 categories (that I’ll have) with new templates. The rest will use the default.

    That’s it! Just sharing! 🙂

Viewing 15 replies - 1 through 15 (of 16 total)
  • hayscg

    (@hayscg)

    Wow that is so cool. How you do that? Can it be done with 3 colums

    jinsan

    (@jinsan)

    it’s quite easy once you know how:)

    hayscg it can be done with any number of columns, with as many categories as you want, and you can have a vastly different style for each one. Do as jberlund has done, as well as others, and read up on the articles and in this forum for relevant questions. It’s been one of the most requested features – it works, but it also takes work to make it work – well, that is it takes time depending on how deep and extensive you want changes. I guess only your imagination is the limitation.

    FOr example, for the category film you can have a site that is completely different to one on , say, Farms. Each can be unique in design.

    Thread Starter jberglund

    (@jberglund)

    The header is used for the php and style sheet calls on this design. (based off the Kubrick files). So, yes, it can be done with 3 column layouts, too.

    I was trying to work through some of the options with Moshu last week, which gave me more insight into what I needed to do. Check out the thread here: http://wordpress.org/support/topic.php?id=29434

    One of the COOL parts about doing the categories this way (though, some may not like it) is that my main page now becomes an almost dyamic layout. Every new post I make, the main page changes with the category I give the current post. 🙂

    So, one day my main page will have my general template up. A few hours later, if I post a home remodeling entry, THAT template takes over. I love it!

    Thread Starter jberglund

    (@jberglund)

    Let me rephrase that first paragraph:
    The ‘header.php’ file has the code for the style sheet and the php to ‘change’ the templates per category.

    divrom

    (@divrom)

    That’s great. I’m most impressed that u did this with cats, not pages.

    Thread Starter jberglund

    (@jberglund)

    Thanks! It’s nice to finally feel like I’m giving something back to the board, instead of just asking for help. 🙂

    wilh

    (@wilh)

    Just a note, the following is a brainstorm session more than a solution. Hopefully it will lead to some feedback and a possible solution in the future.

    It seems to me that there should be a way to put the category check higher up, before the theme is selected. As I understand it, currently, the wp-blog-header.php file is responsible for delegating down to the theme’s files for a given request. If that request is for a category, then the theme’s category php file is loaded (using the standard rules: category-X.php then category.php, etc.).

    It seems that that function get_category_template() would be the proper location for this check to happen. Currently, it uses the TEMPLATEPATH variable to check for the existence of and return the appropriate php file to include. If we could refactor that part of the code so that a new function, get_template_path was called to determine the template path, then the entire theme could be modified on a per-category basis.

    There appears to already be a get_template_directory function that will do what we want it to do. We just need to parameterize it so that it can vary its return value based on a category id (or any other aribitrary information, for that matter). The problem, as I see it, then becomes 1) replacing all occurances of TEMPLATEPATH with a more dynamic call and 2) ensuring that any sibling HTTP requests get the same template. For example, if the specialized category page requests a themed image, that the image is requested with the appropriate theme, as well. Number one seems rather easy, while two could get hairy as there are numerous places where external links and files may be requested and need to be kept in proper order.

    Any ideas for how to accomplish that would be most appreciated as this is something I’m looking to do with my site.

    Thanks,

    Wil

    Lorelle

    (@lorelle)

    jberglund: Isn’t this fun.

    I also fell in love with this and have been using it on my site for a couple months, thanks to the handy folks here who helped me figure it out. My shifts and changes are much more subtle, but they do the job they are intended to do.

    Great work.

    I did notice however that your sidebar is messed up at the meta section and below – the site is too pretty to have a little boo boo. I think it’s a missing div or li – easy fix.

    Really wonderful stuff!

    Thread Starter jberglund

    (@jberglund)

    Thanks, Lorelle. I appreciate the feedback!

    Yes. It DOES feel good to accomplish stuff like this. I love a good puzzle. I love it even more when I solve it the way I want! 🙂

    Hmm… that’s odd. My Meta section looks fine on my screen. What browser/platform are you running? I’m looking at mine with IE on a PC platform. Maybe it’s a browser discrepancy. (I still need to download Firefox and a couple others for testing purposes).

    Let me know and I’ll do further checking. Thanks again! 🙂

    Lorelle

    (@lorelle)

    I noticed it in FF – download it and install the Web Development add on and you will NEVER turn back. Honest. I waited too long and wish I’d had it years ago.

    Thread Starter jberglund

    (@jberglund)

    I’ll do it today! Thanks! 🙂

    Thread Starter jberglund

    (@jberglund)

    Lorelle,

    I see what you mean about the Meta info being out of whack. Any thoughts as to a fix for it? Looks perfect in IE. I’m surprised it’s so off-kilter in FF.

    Weird!

    moshu

    (@moshu)

    @jberglund,
    I was away last week – no computer, no internet 🙂
    I am really glad you succeeded. Great job!

    TechGnome

    (@techgnome)

    The reason for the meta being kicked out is because the calendar isn’t included as part of the list items of the menu…. it’s simply represented as a table in line…. try wrapping your call to the calendar with li tags….

    Tg

    Thread Starter jberglund

    (@jberglund)

    Thanks, TechGnome. I’ll give that a try.
    And, Moshu – Ugh! No Computer?! Brave soul!
    The code is on our other thread: http://wordpress.org/support/topic.php?id=29434

    Check it out and give it a try. Thanks again!

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Working Category Templates!’ is closed to new replies.