WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] wp_list_bookmarks Not Honoring My Exclude Category

[Resolved] wp_list_bookmarks Not Honoring My Exclude Category

  • We’re getting ready to do a site launch in the next 24 hours and this page is misbehaving.

    http://blusd.mytestbed.com/links/

    I’ve got a separate links.php page with this code in it, to call all the bookmarks except “Member Bands” which is ID 2.

    <?php wp_list_bookmarks('exclude=2'); ?>

    We also have a separate Member Bands page template with this code, which shows only the links in the “Member Bands” category, but with descriptions and some other formatting. It’s working beautifully. CRAP!! Now neither template is working! Arrhghgh!

    The code:
    <?php wp_list_bookmarks('include=2,title_li=&show_description=true&between=: '); ?>

    The page:
    http://blusd.mytestbed.com/member-bands/

    What am I doing wrong with the Links page? Do I need to specifically INCLUDE all the other categories except ID 2?

    That’s gonna be a big PITA when it’s all said and done, since there will eventually be a lot of categories and these folks shouldn’t have to go in and add another cat ID to the “include” list each time they create a new one.

Viewing 15 replies - 1 through 15 (of 16 total)
  • I “unpublished” the Links page since it was messing with the Member Bands page .. hoping to get the Member Bands page back. Nope. It’s completely hosed. What’s up with this?!?!?

    From the Codex:

    exclude
    (string) Comma separated list of numeric bookmark IDs to exclude. For example, ‘exclude=4,12’ means that bookmark IDs 4 and 12 will NOT be returned or echoed. Defaults to (exclude nothing).

    I just use the category=1,5,6 parameter to specify which bookmark categories show.

    Yes, I did that with the member-bands page and it was working before I added another page using EXCLUDE. I have read the codex backward and forward and the code I posted for each page SHOULD work, should it not? As explained, these folks are going to be adding categories and I don’t think they should have to remember to ADD a string of ID numbers (once they’ve even found them) to the page template before doing so, do you?

    Any thoughts as to WHY this isn’t working? And why, now all of a sudden, the original Member Bands page isn’t working anymore, even tho I deleted the links page?!?!?

    To clarify for you:

    Desired:
    Links Page #1: INCLUDE ONLY ID FROM ONE CATEGORY (2)
    Page code:
    <?php wp_list_bookmarks('include=2,title_li=&show_description=true&between=: '); ?>

    Result (not working):
    http://blusd.mytestbed.com/member-bands/

    Desired:
    Links Page #2: INCLUDE ALL LINKS EXCEPT THOSE FROM CATEGORY 2
    Page code:
    <?php wp_list_bookmarks('exclude=2'); ?>

    Result (not working):
    http://blusd.mytestbed.com/links/

    Hookay. This is getting REALLY WEIRD. First of all, I was able to recreate the Member Band link listing by deleting all the other categories, which forced it to display member bands. I swiped the source code for that listing and just created a static page. (So much for the beauty of content management, huh?)

    Then I decided to restore those four new categories. Now I’ve also decided to just INCLUDE THEM (to hell with the client’s convenience at this point, I just want the site up and running).

    So I changed the code in the links template to this:
    <?php wp_list_bookmarks('include=12,13,14,15'); ?>

    And here’s what I get now: Notice that even tho ID 2 is EXCLUDED specifically, it still appears, and look what’s happening to the links!!!
    http://blusd.mytestbed.com/links/

    WTF, WP?

    include and exclude here apply to individual bookmarks not bookmark categories.

    damn i’m dumb. thanks iridiax!!! let me go check your theory! {{slinks away in shame}}

    Yep, works like a charm. In a perfect world, I’d have prefered them not to have to go in and manually add those cat IDs when they add categories, but heh, I’ll take what I can get and maybe they won’t add any new cats. 🙂

    http://blusd.mytestbed.com/member-bands/
    CODE:
    <?php wp_list_bookmarks('category=2&title_li=&show_description=true&between=: '); ?>

    http://blusd.mytestbed.com/links/
    CODE:
    <?php wp_list_bookmarks('category=12,13,14,15'); ?>

    Iridiax, contact me off list (check my profile) please!!

    damn i’m dumb. thanks iridiax!!! let me go check your theory! {{slinks away in shame}}

    LOL. You name a mistake, and I’ve probably made it myself. 😉 I couldn’t get include/exclude to work right either and then ended up using category.

    Use the ‘exclude_category’ parameter if you want to exclude whole categories.

    wp_list_bookmarks('exclude_category=2');

    Thanks Otto. I’ll check that out. Maybe I didn’t scroll down far enough in the codex to see that. (cuz it’s hard to see with egg on your face!) 🙂

    brainspiral

    @brainspiral

    Hi. What if I want to use wp_list_bookmarks to display the union of bookmarks in two different categories. I know if I pass category=1,2, it will display all the bookmarks in BOTH category 1 and category 2. And I’ve tried passing something like this:
    array(‘category__and’ => array(51,60))

    But it seems to be completely ignored by wp_list_bookmarks.

    Perhaps wp_list_bookmarks has some other limitations.

    Small update, has anyone tried exclude_category instead of exclude?

    See also: http://www.ramonfincken.com/permalink/topic142.html

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘[Resolved] wp_list_bookmarks Not Honoring My Exclude Category’ is closed to new replies.
Skip to toolbar