\n$text\n";
return $text;
}
/**
* tarski_sidebar_links() - Returns an array for use with wp_list_bookmarks().
*
* If a link category has been selected as external links in the navbar,
* it will be excluded from this array. Because wp_list_bookmarks() has no way
* to exclude categories, this function is inefficient. This core patch
* {@link http://trac.wordpress.org/ticket/6808} would allow a substantially
* simpler function with one less database call.
* @link http://trac.wordpress.org/ticket/6808
* @since 2.0
* @return array $options
*/
function tarski_sidebar_links() {
$link_cat_args = array(
'orderby' => 'term_id',
'exclude' => get_tarski_option('nav_extlinkcat'),
'hierarchical'=> 0
);
$link_categories = &get_terms('link_category', $link_cat_args);
foreach($link_categories as $link_cat)
$link_cats[] = $link_cat->term_id;
$link_cats = implode(',', $link_cats);
$options = array(
'category' => $link_cats,
'category_before' => '',
'category_after' => '',
'title_before' => '
',
'title_after' => '
',
'show_images' => 0,
'show_description' => 0,
);
$options = apply_filters('tarski_sidebar_links', $options);
return $options;
}
/**
* tarski_widget_links() - Tarski links widget.
*
* Doesn't display links from the category being used in the navbar,
* if one is set.
* @since 2.1
* @see wp_widget_links()
* @param array $args
* @return string
*/
function tarski_widget_links($args) {
extract($args, EXTR_SKIP);
wp_list_bookmarks(array_merge(tarski_sidebar_links(), array('category_before' => $before_widget, 'category_after' => $after_widget)));
}
/**
* tarski_widget_search() - Replaces the default search widget.
*
* Hopefully temporary, a patch has been proposed for WP 2.6
* which does the same thing.
* @since 2.1
* @link http://trac.wordpress.org/ticket/5567
*/
function tarski_widget_search($args) {
extract($args, EXTR_SKIP);
$searchform_template = get_template_directory() . '/searchform.php';
if ( !file_exists($searchform_template) )
$searchform_template = get_theme_root() . '/default/searchform.php';
echo $before_widget;
include_once($searchform_template);
echo $after_widget;
}
/**
* tarski_recent_entries() - Recent entries รก la Tarski.
*
* Basically a ripoff of the WP widget function wp_widget_recent_entries().
* @since 2.0.5
* @see wp_widget_recent_entries()
* @global object $posts
* @return string
*/
function tarski_recent_entries($args) {
if ( $output = wp_cache_get('tarski_recent_entries') )
return print($output);
ob_start();
extract($args);
global $posts;
// Allow for configuration in the future
$options = array();
// $options = get_option('tarski_recent_entries');
$title = empty($options['title']) ? __('Recent Articles','tarski') : $options['title'];
if ( !$number = (int) $options['number'] )
$number = 5;
elseif ( $number < 1 )
$number = 1;
elseif ( $number > 10 )
$number = 10;
if ( is_home() )
$offset = count($posts);
else
$offset = 0;
$r = new WP_Query("showposts=$number&what_to_show=posts&nopaging=0&post_status=publish&offset=$offset");
if ( $r->have_posts() ) {
?>
have_posts()) : $r->the_post(); ?>
-