Ejemplo n.º 1
0
function wp_widget_multi_pages_setup()
{
    $options = $newoptions = get_option('widget_multi_pages');
    if (isset($_POST['multi-pages-number-submit'])) {
        $number = (int) $_POST['multi-pages-number'];
        if ($number > 9) {
            $number = 9;
        }
        if ($number < 1) {
            $number = 1;
        }
        $newoptions['number'] = $number;
    }
    if ($options != $newoptions) {
        $options = $newoptions;
        update_option('widget_multi_pages', $options);
        wp_widget_multi_pages_register($options['number']);
    }
}
<?php

if (function_exists('register_sidebar_widget')) {
    if (function_exists('wp_register_sidebar_widget')) {
        global $wp_register_widget_defaults;
        $wp_register_widget_defaults = false;
        wp_widget_multi_pages_register();
        register_sidebar_widget('SEO Archives', 'wp_seo_get_archives');
    }
}
/* link navigation hack by Orien http://icecode.com/ */
function wp_seo_get_archives_link($url, $text, $format = 'html', $before = '', $after = '', $do_nofollow = false)
{
    $text = wptexturize($text);
    $title_text = attribute_escape($text);
    $nofollow_text = 'nofollow';
    if ('link' == $format) {
        return "\t<link rel='archives" . ($do_nofollow ? $nofollow_text : '') . "' title='{$title_text}' href='{$url}' />\n";
    } elseif ('option' == $format) {
        return "\t<option value='{$url}'>{$before} {$text} {$after}</option>\n";
    } elseif ('html' == $format) {
        return "\t<li>{$before}<a href='{$url}' title='{$title_text}'" . ($do_nofollow ? ' rel="' . $nofollow_text . '"' : '') . ">{$text}</a>{$after}</li>\n";
    } else {
        // custom
        return "\t{$before}<a href='{$url}' title='{$title_text}'" . ($do_nofollow ? ' rel=\\"' . $nofollow_text . '\\"' : '') . ">{$text}</a>{$after}\n";
    }
}
function wp_seo_get_archives($args)
{
    global $wp_locale, $wpdb;
    extract($args);