[resolved] wp_list_bookmarks - exclude category (9 posts)

  1. lowrez
    Posted 8 years ago #

    I have found how to include a single cagetory in my blogroll links, but am unable to exclude a category. The following example results in the display of only 'category 2' category name and links. I want to display all except "category 2'.

    <?php wp_list_bookmarks('categorize=1&category=2&title_li='); ?>

    Using version 2.2.2


  2. MichaelH
    Posted 8 years ago #

    Try the exclude=2 paramter.

    See template tag, wp_list_bookmarks()

  3. lowrez
    Posted 8 years ago #

    I did try the exclude=2, which resulted in a wp error.

    WordPress database error: [Column 'link_id' in where clause is ambiguous]..

    <?php wp_list_bookmarks('categorize=1&exclude=2&title_li='); ?>

    perhaps this is an issue only related to version 2.2.2.

  4. MichaelH
    Posted 8 years ago #

    My confusing here, there is no exclude category parameter--the exclude works to exclude specific links.

    But could try the category=1,2,3 parameter where you could build a list of the categories you did want displayed.

  5. lowrez
    Posted 8 years ago #

    Currently, your suggestion seems to be the only solution. This is less than optional because new categories will not automatically display.

    Thanks for your help.

  6. lowrez
    Posted 8 years ago #

    The magical mystery hack has been discovered. Please note that this is a hack with no guarantee of working in future releases of WP.


  7. MichaelH
    Posted 8 years ago #

    Even more magical because I find no reference to exclude_categories in WordPress 2.2.3 or 2.3.

  8. alexo05
    Posted 8 years ago #

    Hmm that didn't work for me :(

    Using WP 2.2.3

  9. Heh. This should work, but I warn you, it's a massive ugly hack. :)

    <?php wp_list_bookmarks( array(
    'categorize' => '1',
    'category' => '&exclude=2',
    'title_li' => '',
    ) ); ?>

    I warned you. But given the current code in 2.3.1, I think it'll do. I make absolutely no guarantees for future revisions.

Topic Closed

This topic has been closed to new replies.

About this Topic