コード例 #1
0
ファイル: ta_shortcode.php プロジェクト: uglmee/kikiku.com
function wp_thumbnails_handler($atts)
{
    $def = "null";
    extract(shortcode_atts(array('type' => 'random', 'num' => $def, 'width' => $def, 'height' => $def, 'id' => $def, 'media' => $def, 'thumb' => $def, 'order' => $def), $atts));
    $args = "display=false";
    if ($num != $def) {
        $args .= "&num={$num}";
    }
    if ($width != $def) {
        $args .= "&width={$width}";
        if ($height != $def) {
            $args .= "&height={$height}";
        }
    }
    if ($id != $def) {
        $args .= "&id={$id}";
    }
    if ($media != $def) {
        $args .= "&media={$media}";
        if ($thumb != $def) {
            $args .= "&thumb={$thumb}";
        }
    }
    if ($order != $def) {
        $args .= "&order={$order}";
    }
    if ($type == 'random') {
        return wp_thumbnails_for_random_posts($args);
    } else {
        if ($type == 'recent') {
            return wp_thumbnails_for_recent_posts($args);
        } else {
            if ($type == 'popular') {
                return wp_thumbnails_for_popular_posts($args);
            } else {
                if ($type == 'related') {
                    return wp_thumbnails_for_related_posts($args);
                } else {
                    if ($type == 'single') {
                        return wp_thumbnails_for_single_post($args);
                    } else {
                        if ($type == 'category') {
                            return wp_thumbnails_for_category($args);
                        } else {
                            if ($type == 'tag') {
                                return wp_thumbnails_for_tag($args);
                            }
                        }
                    }
                }
            }
        }
    }
}
コード例 #2
0
ファイル: ta_post.php プロジェクト: uglmee/kikiku.com
function wp_thumbnails_posts_auto($content)
{
    $options = get_option('thumbnails_anywhere_options');
    if (is_single()) {
        $output = "";
        if ($options["auto_random"] == "true") {
            $thumbnails = wp_thumbnails_for_random_posts('display=false');
            if ($thumbnails) {
                $output .= '<div id="sssaaas">' . $options["auto_random_title"] . $thumbnails . "</div>";
            }
        }
        if ($options["auto_related"] == "true") {
            $thumbnails = wp_thumbnails_for_related_posts('display=false');
            if ($thumbnails) {
                $output .= '<div id="sssaaas">' . $options["auto_related_title"] . $thumbnails . "</div>";
            }
        }
        if ($options["auto_single"] == "true") {
            $thumbnails = wp_thumbnails_for_single_post('display=false&wrap=false');
            if ($thumbnails) {
                $output .= '<div id="sssaaas">' . $options["auto_single_title"] . $thumbnails . "</div>";
            }
        }
        $content = $content . $output;
    }
    return $content;
}
コード例 #3
0
ファイル: ta_widget.php プロジェクト: uglmee/kikiku.com
 function widget_ta_related($args)
 {
     extract($args);
     echo $before_widget;
     $ta_related_options = get_option('widget_ta_related');
     $title = $ta_related_options['title'];
     if (empty($title)) {
         $title = '相关文章';
     }
     //设置默认的标题
     echo $before_title . $title . $after_title;
     $output = wp_thumbnails_for_related_posts();
     echo $output;
     echo $after_widget;
 }