WordPress.org

Ready to get started?Download WordPress

Forums

Exclude_category bookmarks problem (13 posts)

  1. maisteriharju
    Member
    Posted 5 years ago #

    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?

  2. maisteriharju
    Member
    Posted 5 years ago #

    Anyone?

  3. maisteriharju
    Member
    Posted 5 years ago #

    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?

  4. maisteriharju
    Member
    Posted 5 years ago #

    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(); ?>
  5. maisteriharju
    Member
    Posted 5 years ago #

    Anyone?

  6. maisteriharju
    Member
    Posted 5 years ago #

    Come on!

  7. maisteriharju
    Member
    Posted 5 years ago #

    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>'
  8. zuberi
    Member
    Posted 5 years ago #

    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?

  9. cinemaminima
    Member
    Posted 5 years ago #

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

  10. Birdie
    Member
    Posted 5 years ago #

    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.

  11. Birdie
    Member
    Posted 5 years ago #

    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.

  12. starbug72
    Member
    Posted 4 years ago #

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

  13. eastwoodarts
    Member
    Posted 4 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic