Пример #1
0
function foundation_featured_setup()
{
    if (function_exists('add_theme_support')) {
        add_theme_support('post-thumbnails');
        add_image_size('foundation-featured-image', 900, 9999, false);
    }
    global $foundation_featured_posts;
    $settings = foundation_get_settings();
    $args = foundation_featured_get_args();
    if ($settings->featured_enabled) {
        $slides = foundation_featured_get_slides();
        $slide_count = 0;
        if ($slides->post_count > 0) {
            while ($slides->have_posts() && $slide_count < $args['num']) {
                $slides->the_post();
                $image = foundation_featured_has_image();
                if ($image) {
                    $slide_count++;
                    $foundation_featured_posts[] = get_the_ID();
                }
            }
        }
    }
    add_filter('parse_query', 'foundation_featured_modify_query');
}
Пример #2
0
function foundation_featured_slider($manual = false, $manual_html = false)
{
    $settings = foundation_get_settings();
    $args = foundation_featured_get_args();
    if ($manual == false && $settings->featured_enabled) {
        $slides = foundation_featured_get_slides();
        $slide_count = 0;
        if ($slides->post_count > 0) {
            echo $args['before'];
            echo "<div id='slider' class='" . implode(' ', foundation_featured_get_slider_classes()) . "'>\n";
            echo "<div class='swipe-wrap'>\n";
            while ($slides->have_posts() && $slide_count < $args['num']) {
                $slides->the_post();
                $image = foundation_featured_has_image();
                if ($image) {
                    $slide_count++;
                    get_template_part('featured-slider');
                }
            }
            echo "</div>\n";
            echo "</div>\n";
            echo $args['after'];
        }
    } else {
        // Private for now, we'll improve manual mode for customer use in 3.2
        echo $args['before'];
        echo "<div id='slider' class='" . implode(' ', foundation_featured_get_slider_classes()) . "'>\n";
        echo "<div class='swipe-wrap'>\n";
        echo $manual_html;
        echo "</div>\n";
        echo "</div>\n";
        echo $args['after'];
    }
}