WordPress: too clever for its own documentation!

Any time you start using Widgets you forgo control and sometimes you need to take it back! A while ago I needed to control the sort order  of the Links widget and found the “right way” to do it. Today, I needed it again but could I find the documentation anywhere?

In the end I found it at the bottom of a thread answered by Pinoy.ca.

All you need to do is find the functions.php file for your theme and add

function widget_links_args_filter($args) {	$args['orderby'] = 'rating';  // Sort links by rating	$args['order'] = 'DESC';      // descending	return $args;}add_filter('widget_links_args','widget_links_args_filter');

Its easy to understand what you’re doing once you have that small example. A shame, I guess, that sort order isn’t able to be set in the widget itself but if you need to make the change this is so much safer than messing with the source code as some sites recommend.

widget_links_args – try searching on Google or WordPress.org, you won’t find any official documentation for this function. Crazy!

cheap deal pill viagra viagra Viagra Canada viagra and street drugs
generic viagra gel tab Purchase Viagra best place to buy viagra
effects of viagra mixed with cocaine! Guaranteed Cheapest Viagra where can i get free viagra!
viagra for plants Natural Viagra Smode su viagra webrb int mc smoking viagra 431.
Viagra depression women viagra derivatives 471. Natural Viagra Substitutes viagra pre and post!

Categories

Recent Comments

Tags

One Comment

  1. Cristian Giordano
    November 17, 2010

    Thank you, this saved my life.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.