Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_list_bookmarks [ WordPress Function ]

wp_list_bookmarks ( $args = '' )
Parameters:
  • (string|array) $args Optional. Overwrite the defaults of the function
Uses:
Links:
See:
Returns:
  • (string|null) Will only return if echo option is set to not echo. Default is not return anything.
Defined at:



Retrieve or echo all of the bookmarks.

List of default arguments are as follows: 'orderby' - Default is 'name' (string). How to order the links by. String is based off of the bookmark scheme. 'order' - Default is 'ASC' (string). Either 'ASC' or 'DESC'. Orders in either ascending or descending order. 'limit' - Default is -1 (integer) or show all. The amount of bookmarks to display. 'category' - Default is empty string (string). Include the links in what category ID(s). 'category_name' - Default is empty string (string). Get links by category name. 'hide_invisible' - Default is 1 (integer). Whether to show (default) or hide links marked as 'invisible'. 'show_updated' - Default is 0 (integer). Will show the time of when the bookmark was last updated. 'echo' - Default is 1 (integer). Whether to echo (default) or return the formatted bookmarks. 'categorize' - Default is 1 (integer). Whether to show links listed by category (default) or show links in one column. 'show_description' - Default is 0 (integer). Whether to show the description of the bookmark.

These options define how the Category name will appear before the category links are displayed, if 'categorize' is 1. If 'categorize' is 0, then it will display for only the 'title_li' string and only if 'title_li' is not empty. 'title_li' - Default is 'Bookmarks' (translatable string). What to show before the links appear. 'title_before' - Default is '

' (string). The HTML or text to show before the 'title_li' string. 'title_after' - Default is '

' (string). The HTML or text to show after the 'title_li' string. 'class' - Default is 'linkcat' (string). The CSS class to use for the 'title_li'.

'category_before' - Default is '

  • '. String must contain '%id' and '%class' to get the id of the category and the 'class' argument. These are used for formatting in themes. Argument will be displayed before the 'title_before' argument. 'category_after' - Default is '
  • ' (string). The HTML or text that will appear after the list of links.

    These are only used if 'categorize' is set to 1 or true. 'category_orderby' - Default is 'name'. How to order the bookmark category based on term scheme. 'category_order' - Default is 'ASC'. Set the order by either ASC (ascending) or DESC (descending).

    Source

    
    <?php
    function wp_list_bookmarks($args '') {
        
    $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>'
        
    );

        
    $r wp_parse_args$args$defaults );
        
    extract$rEXTR_SKIP );

        
    $output '';

        if ( 
    $categorize ) {
            
    //Split the bookmarks into ul's for each category
            
    $cats get_terms('link_category', array('name__like' => $category_name'include' => $category'exclude' => $exclude_category'orderby' => $category_orderby'order' => $category_order'hierarchical' => 0));

            foreach ( (array) 
    $cats as $cat ) {
                
    $params array_merge($r, array('category'=>$cat->term_id));
                
    $bookmarks get_bookmarks($params);
                if ( empty(
    $bookmarks) )
                    continue;
                
    $output .= str_replace(array('%id''%class'), array("linkcat-$cat->term_id"$class), $category_before);
                
    $catname apply_filters"link_category"$cat->name );
                
    $output .= "$title_before$catname$title_after\n\t<ul class='xoxo blogroll'>\n";
                
    $output .= _walk_bookmarks($bookmarks$r);
                
    $output .= "\n\t</ul>\n$category_after\n";
            }
        } else {
            
    //output one single list using title_li for the title
            
    $bookmarks get_bookmarks($r);

            if ( !empty(
    $bookmarks) ) {
                if ( !empty( 
    $title_li ) ){
                    
    $output .= str_replace(array('%id''%class'), array("linkcat-$category"$class), $category_before);
                    
    $output .= "$title_before$title_li$title_after\n\t<ul class='xoxo blogroll'>\n";
                    
    $output .= _walk_bookmarks($bookmarks$r);
                    
    $output .= "\n\t</ul>\n$category_after\n";
                } else {
                    
    $output .= _walk_bookmarks($bookmarks$r);
                }
            }
        }

        
    $output apply_filters'wp_list_bookmarks'$output );

        if ( !
    $echo )
            return 
    $output;
        echo 
    $output;
    }
    ?>

    Examples [ wp-snippets.com ]

    Top Google zoekresultaten

    Meer ...

    0 User Note(s)

    Nog geen één. Wees de eerste!

    Nieuw toevoegen ...



    HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics