Forums

[resolved] Pages by category? (11 posts)

  1. Luderbrus
    Member
    Posted 3 years ago #

    So I am working on a new version of my bloggie. What I need is a way to make the menu show two links to two entirely different pages; "BLOG" and "CHRONICLES".

    Basicly I want to be able to write the posts as usual but when i define the category as "Blog" I want that post to end up on the "BLOG" page. If I however write something a little deeper where I air an opinion or something a little lenghtier I want it to end up in the "Chronicles" page. I do not want any of these different posts to end up in the other "page".

    *EDIT To be clear: I want to be able to define sub-categories to the posts.

    It is quite possible that this is the easiest thing in the world but my PHP skills are moderate at best :)

    Oh yeah; If there is any way of adding an ad-sense ad after say five posts out of ten and always keep it there, that wouldn't be bad either :)

    Any tips are greatly appreciated at this point. Thanks.

  2. moshu
    Member
    Posted 3 years ago #

    Instead of struggling with the "page" issue, why not use two categories for them with their own category_XX.php templates (where XX is the cat ID#) - and exclude these categories from other views.
    Category_Templates
    For excluding, see this: http://wordpress.org/support/topic/56529?replies=7#post-307098

    Edit. P.S. Pages do not have categories.

  3. Luderbrus
    Member
    Posted 3 years ago #

    Fantastic. Never realized it could all be that simple.
    Thanks a bunch moshu :)

  4. Luderbrus
    Member
    Posted 3 years ago #

    Still, I seem to be unable to get it working...

    Could someone be so kind as to give an example of how to define what category to be displayed in the category-1.php?

    I am using a heavily modified Blix theme and it lacks a file named category.php. It does however have a file named archives.php

  5. jaredquinn
    Member
    Posted 3 years ago #

    category-1.php will be used when someone is viewing the category id 1.

    If you setup your categories and sub categories, you would have two links from somewhere. These would be the category archive views that would use the two templates defined as (category-x.php).

    The category links would be drawn using a call to wp_list_cats

    <?php
    wp_list_cats('list=1&children=0&optioncount=0");
    ?>

    (probably in your sidebar, or navigation area) would product a link to your top two levels of category. These pages would use the template pages as above.

  6. Luderbrus
    Member
    Posted 3 years ago #

    Ok. So I can't point a link to just category-1.php? It seems however I code it, even making an exact copy of index.php, it says there is no input file.

    I removed the sidebar from my site so theres no way of just "picking the category" except for right under the title for every post (I will remove the categories from there as soon as I get this working). Is there a way to get these two categories up in the navigation area in a simple way?

    My testsite is up at http://www.slagzone.com/wordpress/

    Thanks jaredquinn :)

  7. Luderbrus
    Member
    Posted 3 years ago #

    After quite some struggle I realized that what I needed was what you suggested, only <?php list_cats(); ?> instead.

    I still don't know the difference but I feel wiser.

  8. moshu
    Member
    Posted 3 years ago #

    1. Blix sucks when it comes about modifying...
    2. WP is smart enough to pick up the proper category template when you click on a certain category's link.
    3. Saving the archive.php as category.php or catgeory_X.php is fine; just make the changes you need.
    4. You should never link directly to template file!
    5. The template tag you posted above is the default. Jared added some parameters to it.

  9. Luderbrus
    Member
    Posted 3 years ago #

    1. Yes, Blix can be a b***h but I've been putting some two weeks into photoshopping what I want, CSS:ing it to look like I want and then adjusting it by asking guys like yourselves a bunch of dumb questions. So close now... Cant throw that time away :(

    2. Yeah. Wordpress rocks :)

    3. Yeah, found out I didn't need that though.

    4. Learned the hard way :)

    5. Yeah. But his example killed my whole site. Not blaming his skills though, I probably mis-ctrl+v:ed it, so to say. why the prefix "wp_" though?

    I got a new bag of problems now. Blix won't recognize that I am in the category I used. It won't show that button as being "active". If I were to post some thirty lines of code here from Blix. You think you could find the error in my ways?

  10. Luderbrus
    Member
    Posted 3 years ago #

    Rephrase:

    Could I add something along the lines of "If category is #9 then make link active"?

  11. moshu
    Member
    Posted 3 years ago #

    I don't think any of the themes (as far as I know) shows if a category link is "active" - if you mean being highlighted that you are viewing that category.

    Re: 5. - because there are several template tags to display the categories: Template_Tags#Category_tags. (It's always good to keep the Codex open in a window/tab when you work on your theme ;)

    Long code is not welcome here, but you can always use http://pastebin.com and post the URL so people can take a look at your code.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags