• Hi,

    I have a problem using the exclude_category tag with bookmarks.

    Here is the code I’m using:

    <?php wp_list_bookmarks('exclude_category=1,3,4&between=<br />&show_description=1') ?>

    Instead of excluding the 1, 3 and 4 categories, it shows all categories.

    Any ideas what’s wrong here?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter maisteriharju

    (@maisteriharju)

    Anyone?

    Thread Starter maisteriharju

    (@maisteriharju)

    I looked into depth of the WordPress core and couldn’t find ‘exclude_category’ from bookmark-template.php and bookmark.php.

    Is it so that exclude_category isn’t coded at all to the bookmark-template.php in 2.5.1? From bookmark.php I found ‘exclude’ but I still have no idea how to make it exclude the category. If I use just exclude-tag instead of exclude_category it removes certain bookmarks but not bookmark categories.

    Hmm… or is there just some typo in my code?

    Thread Starter maisteriharju

    (@maisteriharju)

    Can someone who knows better confirm that exclude_category doesn’t work with bookmarks? My deadline is killing me.

    Here is the full page template I’m using. It doesn’t exclude the 1,3 and 4 categories but instead it just shows all the categories:

    <?php
    /*
    Template Name: Others
    */
    ?>
    
    <?php get_header(); ?>
    
    <table class="table" cellpadding=0 cellspacing=0 border=0>
    <tr valign=top>
    <td class="leftshade">
    &nbsp;
    </td>
    <td class="sidebar">
    <?php get_sidebar(); ?>
    </td>
    <td id="content">
    
    <div class='narrowcolumn'>
    
    <ul class="list">
    <?php wp_list_bookmarks ('exclude_category=1,3,4&between=<br />&show_description=1') ?>
    </ul>
    
    </div>
    
    </td>
    <td class="rightshade">
    &nbsp;
    </td>
    </tr>
    </table>
    
    <?php get_footer(); ?>
    Thread Starter maisteriharju

    (@maisteriharju)

    Anyone?

    Thread Starter maisteriharju

    (@maisteriharju)

    Come on!

    Thread Starter maisteriharju

    (@maisteriharju)

    I solved it.

    If someone else is having this same problem this is a 2.5.1 problem. I tried the same template with 2.6.2 and it works fine. The “exclude_category”-tag doesn’t exist in bookmark-template.php of 2.5.1 but it exists in 2.6.2’s bookmark-template.php.

    2.5.1:

    $defaults = array(
    		'orderby' => 'name', 'order' => 'ASC',
    		'limit' => -1, 'category' => '',
    		'category_name' => '', 'hide_invisible' => 1,
    		'show_updated' => 0, 'echo' => 1,
    		'categorize' => 1, 'title_li' => __('Bookmarks'),
    		'title_before' => '<h2>', 'title_after' => '</h2>',
    		'category_orderby' => 'name', 'category_order' => 'ASC',
    		'class' => 'linkcat', 'category_before' => '<li id="%id" class="%class">',
    		'category_after' => '</li>'

    2.6.2:

    $defaults = array(
    		'orderby' => 'name', 'order' => 'ASC',
    		'limit' => -1, 'category' => '', 'exclude_category' => '',
    		'category_name' => '', 'hide_invisible' => 1,
    		'show_updated' => 0, 'echo' => 1,
    		'categorize' => 1, 'title_li' => __('Bookmarks'),
    		'title_before' => '<h2>', 'title_after' => '</h2>',
    		'category_orderby' => 'name', 'category_order' => 'ASC',
    		'class' => 'linkcat', 'category_before' => '<li id="%id" class="%class">',
    		'category_after' => '</li>'

    Hiya. It’s just unbelievable that no-one has responded to this yet! I tried importing the 2.6.2 code you listed above into bookmark-template.php in 2.5.1 – and i still can’t get it to work… (I’m not changing my blog to 2.6 ‘cos i really don’t like it at all…) so wondering if this actually works for you?

    I am using WP 2.7.1 and the exclude_category parameter does not work!

    I’m using 2.8.3 and it doesn’t work there either. And there doesn’t seem to be any explanations as to why it doesn’t work. What a shame. Seems like an easy thing for someone in the know to fix too.

    Okay just figured it out. Having a real DUH moment! But I’ll share in case it helps someone else.

    I couldn’t figure out the category ID number. Looking at the admin panel for Bookmark Categories, I saw the number 6, so was using that number. That was the number of bookmarks under that category though not the cat id.Finally figured that out, but couldn’t see anywhere that told me what the category ID number was. Finally noticed if I clicked it the category ID displayed in the URL.

    On 2.8.4 the exclude_category does not work either. Hope this gets fixed in next release.

    exclude_category doesn’t want to work in 2.8.5 either. A decent work around is to use a negative value for the category argument.

    eg instead of exclude_category=44 use category=-44.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Exclude_category bookmarks problem’ is closed to new replies.