WordPress.org

Ready to get started?Download WordPress

Forums

Blogroll link category on a category page (12 posts)

  1. asamuels
    Member
    Posted 7 years ago #

    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?

  2. moshu
    Member
    Posted 7 years ago #

  3. asamuels
    Member
    Posted 7 years ago #

    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.

  4. moshu
    Member
    Posted 7 years ago #

    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.

  5. asamuels
    Member
    Posted 7 years ago #

    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??

  6. asamuels
    Member
    Posted 7 years ago #

    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?

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    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.

  8. asamuels
    Member
    Posted 7 years ago #

    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?

  9. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    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. :)

  10. groovyKimo
    Member
    Posted 7 years ago #

    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...

  11. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    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.

  12. groovyKimo
    Member
    Posted 7 years ago #

    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... :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags