Support » Plugins and Hacks » wp_list_bookmarks question

  • Resolved nadine00



    I have a quick question about wp_list_bookmarks() I would like to display links from more than one specific category. So for example:

    category 1 OR category 2 OR category 3

    How do I do that within this setup:

    <?php $link_args = array(
    ‘category’ => 10,
    ‘orderby’ => ‘name’,
    ‘order’ => ‘DESC’,
    ‘categorize’ => 0,
    ‘title_li’=> __(”),
    ‘show_description’ => 1,
    ‘class’ => ‘link_test’,

    Thank You


Viewing 6 replies - 1 through 6 (of 6 total)
  • MichaelH



    'category' => 10,


    'category' => '1,2,3',



    Thank you. 🙂

    Is there a way to keep links that are in two categories from displaying twice in the same list?



    You’d have to build your own ‘list book marks’

    Do you have any links to references where I can learn to do that? Please, and thank you.

    You’ll probably want to look at wpdb and then Displaying_Posts_Using_a_Custom_Select_Query <–that talks about categories for posts, but can also be used for links.

    Also look at the get_bookmarks function for example of the query and this for the sql

    $query = "SELECT DISTINCT link_id FROM $wpdb->links
    INNER JOIN $wpdb->term_relationships AS tr ON ($wpdb->links.link_id = tr.object_id)
    INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_taxonomy_id = tr.term_taxonomy_id
    WHERE 1=1
    AND link_visible = 'Y'
    AND ( tt.term_id = 4  OR tt.term_id = 10  OR tt.term_id = 113 )
    AND taxonomy = 'link_category'";
    $link_ids = $wpdb->get_col($query);
      'include' => implode(',', $link_ids),
      'orderby' => 'name',
      'order' => 'DESC',
      'categorize' => 0,
      'title_li'=> __(''),
      'show_description' => 1,
      'class' => 'link_test',

    [note deleted the word “quick” from the topic subject]

    Woo! That worked. Thank you! And thanks for the reference page links as well. 🙂


Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘wp_list_bookmarks question’ is closed to new replies.