• Hey everyone.

    The $categories is a array with the category slug. This code works just to the first cycle, which means, only the first category is printing.

    foreach($categories as $category){
      if( wp_list_bookmarks('category_name='.$category.'&echo=0') ){
            wp_list_bookmarks( 'title_li=&category_name='.$category.'&before=<li>&orderby=name' ).
      }
    }
Viewing 1 replies (of 1 total)
  • Hi !

    category_name is the “name” of your category, not the “slug”

    If your category name is “Exemple”, the slug will be “exemple” and wp_list_bookmarks will work because the function is not case sensitive for category_name

    However, if your category name is “My Category Name”, the slug will be “my-category-name” and wp_list_bookmarks will not work

Viewing 1 replies (of 1 total)
  • The topic ‘wp_list_bookmarks in foreach don't work’ is closed to new replies.