• I am trying to list the links in a widget but it is not listing the way I want them to, by ID or date entered.
    I found the function reference for what is now called – bookmarks but I am not sure how to enter this into a widget, I tried the simple text widget with no luck. I’d rather do this without a plugin, but I am thinking I need to add something to the functions file to get this to work.
    Can someone suggest how I can do this?

    Sorry I posted this in another forum, but don’t think it was the correct place.

    Thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • What really links you what to show or to display? In the widget, you can only used [shortcode] to display what you really want add some code in functions.php. Then, call it in your widgets.

    What function are you using? what is the current output of this function? and how did you use this function?

    You tried to paste the function as plain text in widget? it wouldn’t work. let us know what you are trying to achieve ??

    Thread Starter sswinters

    (@sswinters)

    I am using the one found here – https://codex.www.ads-software.com/Function_Reference/wp_list_bookmarks

    I am trying to list the links by date entered, or I guess by id, newest to oldest
    I have tried some plugins, to allow me to enter php onto the text widget, but that failed even working.

    I am not sure what to try next.

    I am sorry, somehow I can’t get this function to work because I don’t have bookmarks or link manager as I didn’t start with v 3.5 at least, but we will try to get a workaround .

    What are you trying to achieve with this function? I mean, what you want it to return? like, a list of all your blog posts ( links ) ?

    Thank you!

    Thread Starter sswinters

    (@sswinters)

    I want to show the links that appear under Admin-Links.

    I would like them in a widget for a sidebar and listed from newest to oldest when they were entered. I am assuming I need to use the ID as there is no date for links.

    [ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]

    function custom_list_bookmarks($args){
    $args = 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'   => '' ); ?>
    wp_list_bookmarks( $args );
    }
    
    add_filter('custom_list_bookmarks', 'custom_list_bookmarks',10,3);

    NOTE: Make sure you back up your functions.php
    add this in your functions.php

    the you can used now your shortcode [custom_list_bookmarks]

    ALERT: Not Tested Yet!

    Thread Starter sswinters

    (@sswinters)

    thanks, when I added the code and a shortcode to the text widget, it just outputted this “[custom_list_bookmarks]”

    Just a little edit for what @mrjohn01 suggested:

    function custom_list_bookmarks($args){
    	$args = 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'   => ''
    	);
    	ob_start();
    	echo wp_list_bookmarks( $args );
    	return ob_get_clean();
    }
    
    add_shortcode('custom_list_bookmarks', 'custom_list_bookmarks');
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘List links by ID’ is closed to new replies.