get IDs from links categories
Ask get_terms() for the ‘link_category’ and restrict the returned fields to IDs: get_terms( ‘link_category’, array ( ‘fields’ => ‘ids’ ) );
Ask get_terms() for the ‘link_category’ and restrict the returned fields to IDs: get_terms( ‘link_category’, array ( ‘fields’ => ‘ids’ ) );
It looks like the default get_bookmarks() http://codex.wordpress.org/Function_Reference/get_bookmarks is using this query: SELECT * FROM wp_links WHERE 1=1 AND link_visible=”Y” ORDER BY link_name ASC; You can check the function in /wp-includes/bookmark.php. The get_bookmarks() function has limit and order parameters that you might find helpful. The option get_bookmarks(“limit=5”) gives this query: SELECT * FROM wp_links WHERE 1=1 … Read more
I believe that you’re looking for the get_bookmarks() function, which returns an array of bookmark objects. You could then implement this into your code: <?php // Get RSS Feed(s) include_once(ABSPATH . WPINC . ‘/feed.php’); $bookmarks = get_bookmarks(); $rsslist = array(); foreach ( $bookmarks as $bm ) { if ( $bm->link_rss ) $rsslist[] = $bm->link_rss; } … Read more
Not extremely elegant, but should work… $sep = ” | “; $args = array( ‘before’=>”, ‘after’=>$sep, ‘category_after’=>”, ‘category_before’=>”, ‘title_li’=>”, ‘echo’=>0 //return the string, don’t echo ); $str = wp_list_bookmarks($args); //chop off the last separator… $str = substr($str, 0, strlen($str) – strlen($sep)); echo $str; EDIT — I added before and after to the $args array — … Read more
There is a filter ‘wp_list_bookmarks’ for the complete markup. You can use it: add_filter( ‘wp_list_bookmarks’, ‘wpse40213_new_classes’, 10, 1 ); function wpse40213_new_classes( $html ) { return str_replace( “class=”xoxo blogroll””, “class=”my_bookmarks blogroll””, $html ); }
By default add_filter() instructs WP to only pass first parameter to your hooked function. If you want more you need to specify that (and priority which comes earlier and defaults to 10): add_filter( ‘get_bookmarks’, ‘samiconductor_sort_links_by_order’, 10, 2 );
As far as I know it’s not possible to query the links directly, but there is definetly a link_updated field in the wp_links table, so you can use wpdb to interact with it and return the latest (modified) links. There’s also a solution here. EDIT : Updating a link doesn’t change link_updated, but here is … Read more
I’ve tried something similar to that (well, slightly different, what I did was try to create a timeline where posts and comments showed up in the same timeline)… Merging those two arrays is not easy, because the post object has completely different properties to the link object. If you wanted to do it, you’d have … Read more
It should be as simple as that: Just get the terms from the link_category and use the get_terms() argument instead, which should work like you need it. get_terms( ‘link_category’ ,array( ‘include’ => array( 1, 2, 3 ) ,’orderby’ => ‘name’ ,’order’ => ‘ASC’ ,’hierarchical’ => 0 ) );