• I have been searching these forums for an answer to my question, but havent found it.

    I have upgraded to wp2.1 and want to show certain blogroll link categories on certain category pages. example:

    I have a blogroll link category called “greenwidgets”, which has lots of relevant links to “Green Widgets” I would like that displayed on the “green widgets” category page in the sidebar, but not on any other pages.

    http://example.com/category/greenwidgets/

    So how do I define this relationship?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter asamuels

    (@asamuels)

    Thanks Moshu..

    Do you have to define the relationship in the database or do you have to code it into a template?

    Im not really a techie so its a bit confusing.

    I am not a techie either 🙂
    Those conditional tags from the link above should be used in the theme’s template files, e.g. saying something like this:

    if we are on a category ID=X page, show links from category Y…

    Basically, you work with two tags:
    – the conditional
    if (is_category('6'))
    – and the tag for displaying links, e.g.:
    <?php wp_list_bookmarks('category=2'); ?>

    This is the main idea only! For working syntax check the Codex.

    Thread Starter asamuels

    (@asamuels)

    I thought that the new wordpress 2.1 was supposed to do this for you?

    After the upgrade, I can see the link categories that I had before upgrade, but I hasnt updated the link categories to category pages.

    So there is no link between category page and the new link categories.

    Therefore adding the tags above wont help right??

    Thread Starter asamuels

    (@asamuels)

    Okay I tried this code below, but it still shows all blogroll categories on every category page, rather than ones specific to a category id?

    <?php if ( is_home() ) { wp_list_bookmarks(); } ?>
    <?php if ( is_category() ) { wp_list_bookmarks(‘categorize=1&category_name’); } ?>

    Can anyone help please?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Try this instead of your code:

    <?php
    if ( is_home() ) {
    wp_list_bookmarks();
    } else if ( is_category('6') ) {
    wp_list_bookmarks('category=1');
    }
    ?>

    Change the “6” to your post category’s ID number.
    Change the “1” to your link category’s ID number.

    Thread Starter asamuels

    (@asamuels)

    Hey Otto,

    Thanks for this however this surely means I need to do this for every category page? Also WP2.1 links the category page to the link category so for example:

    My category on green widgets has an id=1
    My link category related to green widgets also has an id=1

    So surely they should be some generic cide which maps this relationship?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    My category on green widgets has an id=1
    My link category related to green widgets also has an id=1

    No, they don’t. Categories are now combined in WordPress 2.1.x. So you cannot have a post category and a link category sharing the same ID number.

    If you have not upgraded to 2.1 yet, then you are correct, however any way to “link” the two will fail when you upgrade because of this, so I recommend not relying on some perceived link based on ID numbers.

    Or you’re talking about something I’m not understanding, in which case, please try to clarify. 🙂

    This is somehow similar to my question here (to which noone replies 🙁 )

    I would like to have one catecory x, that contain relatet posts. And at the same time my favorite bookmarks for the theme x and show them in the side bar at the same time.

    Now, as I understand you, Otto42, I need a separate category for the bookmarks?

    Thanks.

    @asamuels: sorry for disturbing your thread…

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Now, as I understand you, Otto42, I need a separate category for the bookmarks?

    It’s difficult to answer your question (I read your other thread), because the answer is not cut and dry.

    In theory, there’s no reason that you can’t have bookmarks and posts in the same category. The database allows for it.

    However, the code seems to make it difficult (or impossible) to actually do that.

    Hopefully this will get fixed/clarified in future revisions of WordPress.

    Hopefully this will get fixed/clarified in future revisions of WordPress.

    Ok, I see, thanks. I hope too! Meanwhile I go and double my categories… 🙂

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Blogroll link category on a category page’ is closed to new replies.