コード例 #1
0
ファイル: featured.php プロジェクト: ahua/www
function foundation_featured_settings($page_options)
{
    $settings = foundation_get_settings();
    if ($settings->featured_enabled) {
        $featured_settings = array(wptouch_add_setting('range', 'featured_max_number_of_posts', __('Maximum number of posts', 'wptouch-pro'), '', WPTOUCH_SETTING_ADVANCED, '2.0', array('min' => 1, 'max' => 10, 'step' => 1)), wptouch_add_setting('checkbox', 'featured_autoslide', __('Automatically slide', 'wptouch-pro'), '', WPTOUCH_SETTING_BASIC, '1.0.2'), wptouch_add_pro_setting('checkbox', 'featured_continuous', __('Continuously slide', 'wptouch-pro'), '', WPTOUCH_SETTING_BASIC, '1.0.2'), wptouch_add_setting('checkbox', 'featured_grayscale', __('Grayscale images (CSS 3 effect)', 'wptouch-pro'), __('Featured slider images will be in grayscale for devices that support CSS filters.', 'wptouch-pro'), WPTOUCH_SETTING_ADVANCED, '1.0'), wptouch_add_setting('checkbox', 'featured_filter_posts', __('Featured slider posts also show in listings', 'wptouch-pro'), '', WPTOUCH_SETTING_BASIC, '1.0.3'), wptouch_add_setting('list', 'featured_speed', __('Slide transition speed', 'wptouch-pro'), '', WPTOUCH_SETTING_ADVANCED, '1.0.2', array('slow' => __('Slow', 'wptouch-pro'), 'normal' => __('Normal', 'wptouch-pro'), 'fast' => __('Fast', 'wptouch-pro'))), wptouch_add_setting('list', 'featured_type', '', '', WPTOUCH_SETTING_BASIC, '1.0', array('latest' => __('Show latest posts', 'wptouch-pro'), 'tag' => __('Show posts from a specific tag', 'wptouch-pro'), 'category' => __('Show posts from a specific category', 'wptouch-pro'), 'post_type' => __('Show posts from a specific post type', 'wptouch-pro'), 'posts' => __('Show only specific posts or pages', 'wptouch-pro'))), wptouch_add_setting('text', 'featured_tag', __('Only this tag', 'wptouch-pro'), __('Enter the tag/category slug name', 'wptouch-pro'), WPTOUCH_SETTING_BASIC, '1.0'), wptouch_add_setting('text', 'featured_tag', __('Only this tag', 'wptouch-pro'), __('Enter the tag/category slug name', 'wptouch-pro'), WPTOUCH_SETTING_BASIC, '1.0', false), wptouch_add_setting('text', 'featured_category', __('Only this category', 'wptouch-pro'), __('Enter the tag/category slug name', 'wptouch-pro'), WPTOUCH_SETTING_BASIC, '1.0', false), wptouch_add_setting('list', 'featured_post_type', __('Only this post type', 'wptouch-pro'), '', WPTOUCH_SETTING_BASIC, '3.5.3', array_merge(array('Select Post Type'), wptouch_custom_posts_get_list())), wptouch_add_setting('text', 'featured_post_ids', __('Comma-separated list of post/page IDs', 'wptouch-pro'), '', WPTOUCH_SETTING_BASIC, '1.0'));
    } else {
        $featured_settings = array();
    }
    wptouch_add_page_section(FOUNDATION_PAGE_GENERAL, __('Featured Slider', 'wptouch-pro'), 'foundation-featured-settings', array_merge(array(wptouch_add_setting('checkbox', 'featured_enabled', __('Enable featured slider', 'wptouch-pro'), __('Requires at least 2 entries to contain featured images', 'wptouch-pro'), WPTOUCH_SETTING_BASIC, '1.0')), $featured_settings), $page_options, FOUNDATION_SETTING_DOMAIN, true);
    return $page_options;
}
コード例 #2
0
function wptouch_custom_post_should_show($current)
{
    global $post;
    $settings = wptouch_get_settings();
    $available_posts = wptouch_custom_posts_get_list();
    if (array_key_exists($post->post_type, $available_posts)) {
        // Show custom post types
        if ($settings->show_custom_post_taxonomy && is_single() && !is_page()) {
            $current = true;
        }
        if ($settings->show_custom_post_taxonomy && !is_single() && !is_page()) {
            $current = true;
        }
    }
    return $current;
}
コード例 #3
0
function foundation_featured_settings($page_options)
{
    $settings = foundation_get_settings();
    global $wptouch_pro;
    $posts_to_show_label = false;
    if (defined('WPTOUCH_IS_FREE')) {
        $posts_to_show_label = 'Posts to display';
    }
    if ($wptouch_pro->get_current_theme() == 'bauhaus' || $wptouch_pro->is_child_theme() && $wptouch_pro->get_parent_theme_info()->base == 'bauhaus') {
        $featured_enhanced_setting = array(wptouch_add_setting('list', 'featured_style', __('Featured slider style', 'wptouch-pro'), false, WPTOUCH_SETTING_BASIC, '2.0', array('enhanced' => __('Enhanced', 'wptouch-pro'), 'streamlined' => __('Streamlined', 'wptouch-pro'))));
    } else {
        $featured_enhanced_setting = array();
    }
    $featured_settings = array(wptouch_add_pro_setting('range', 'featured_max_number_of_posts', __('Number of posts in slider', 'wptouch-pro'), false, WPTOUCH_SETTING_BASIC, '2.0', array('min' => 1, 'max' => 10, 'step' => 1)), wptouch_add_setting('checkbox', 'featured_comments', __('Show # of comments', 'wptouch-pro'), false, WPTOUCH_SETTING_BASIC, '2.0'), wptouch_add_pro_setting('checkbox', 'featured_autoslide', __('Slide automatically', 'wptouch-pro'), false, WPTOUCH_SETTING_BASIC, '2.0'), wptouch_add_pro_setting('checkbox', 'featured_continuous', __('Slides repeat', 'wptouch-pro'), false, WPTOUCH_SETTING_BASIC, '2.0'), wptouch_add_pro_setting('checkbox', 'featured_grayscale', __('Make images grayscale', 'wptouch-pro'), false, WPTOUCH_SETTING_BASIC, '2.0'), wptouch_add_setting('checkbox', 'featured_filter_posts', __('Slider posts also show in listings', 'wptouch-pro'), false, WPTOUCH_SETTING_BASIC, '2.0'), wptouch_add_pro_setting('list', 'featured_speed', __('Slide transition speed', 'wptouch-pro'), false, WPTOUCH_SETTING_BASIC, '2.0', array('slow' => __('Slow', 'wptouch-pro'), 'normal' => __('Normal', 'wptouch-pro'), 'fast' => __('Fast', 'wptouch-pro'))), wptouch_add_setting('list', 'featured_type', $posts_to_show_label, false, WPTOUCH_SETTING_BASIC, '2.0', array('latest' => __('Show latest posts', 'wptouch-pro'), 'tag' => __('Show posts from a specific tag', 'wptouch-pro'), 'category' => __('Show posts from a specific category', 'wptouch-pro'), 'post_type' => __('Show posts from a specific post type', 'wptouch-pro'), 'posts' => __('Show only specific posts or pages', 'wptouch-pro'))), wptouch_add_setting('text', 'featured_tag', __('Only this tag', 'wptouch-pro'), __('Enter the tag/category slug name', 'wptouch-pro'), WPTOUCH_SETTING_BASIC, '2.0', false), wptouch_add_setting('text', 'featured_category', __('Only this category', 'wptouch-pro'), __('Enter the tag/category slug name', 'wptouch-pro'), WPTOUCH_SETTING_BASIC, '2.0', false), wptouch_add_setting('text', 'featured_post_ids', __('Comma-separated list of post/page IDs', 'wptouch-pro'), false, WPTOUCH_SETTING_BASIC, '2.0'));
    if (function_exists('wptouch_custom_posts_get_list')) {
        $featured_settings[] = wptouch_add_pro_setting('list', 'featured_post_type', __('Only this post type', 'wptouch-pro'), false, WPTOUCH_SETTING_BASIC, '2.0', array_merge(array('Select Post Type'), wptouch_custom_posts_get_list()));
    }
    wptouch_add_page_section(FOUNDATION_PAGE_GENERAL, __('Featured Slider', 'wptouch-pro'), 'foundation-featured-settings', array_merge(array(wptouch_add_setting('checkbox', 'featured_enabled', __('Enable featured slider', 'wptouch-pro'), false, WPTOUCH_SETTING_BASIC, '2.0')), $featured_enhanced_setting, apply_filters('wptouch_featured_slider_settings', $featured_settings)), $page_options, FOUNDATION_SETTING_DOMAIN, true, false, 30);
    return $page_options;
}
コード例 #4
0
ファイル: custom-posts.php プロジェクト: sumwander/unyil
function wptouch_custom_posts_pre_get_posts($query)
{
    // Only modify the custom post type information when a mobile theme is showing
    $settings = foundation_get_settings();
    if (!$settings->enable_custom_post_types) {
        return $query;
    }
    if (is_attachment()) {
        return $query;
    }
    // Right now only support custom post types on the home page and single post pages
    if (is_single() && !is_page() || is_category() || is_tax() || is_tag() || is_home()) {
        // Only employ this logic for when the mobile theme is showing
        if (wptouch_is_mobile_theme_showing()) {
            $settings = foundation_get_settings();
            if ($settings->custom_post_types_in_post_index || !is_home() && !is_page()) {
                $post_types = wptouch_custom_posts_get_list(true);
                if ($post_types && count($post_types)) {
                    $post_type_array = get_option('wptouch_custom_post_types');
                    if (is_array($post_type_array)) {
                        $post_type_array = array_flip($post_type_array);
                    } else {
                        $post_type_array = array();
                    }
                }
                if (count($post_type_array)) {
                    // Determine the original post type in the query
                    $original_post_type = false;
                    if (isset($query->queried_object)) {
                        $original_post_type = $query->queried_object->post_type;
                    } else {
                        if (isset($query->query_vars['post_type'])) {
                            $original_post_type = $query->query_vars['post_type'];
                        }
                    }
                    if ($original_post_type) {
                        $page_for_posts = get_option('page_for_posts');
                        if (isset($query->queried_object_id) && $query->queried_object_id == $page_for_posts) {
                            // we're on the posts page
                            $custom_post_types = apply_filters('wptouch_custom_posts_pre_get', array_merge(array('post'), $post_type_array));
                        } else {
                            if (!is_array($original_post_type)) {
                                $original_post_type = array($original_post_type);
                            }
                            $custom_post_types = apply_filters('wptouch_custom_posts_pre_get', array_merge($original_post_type, $post_type_array));
                        }
                        $query->set('post_type', $custom_post_types);
                    } else {
                        // We're on the home page or possibly another page for a normal site
                        $custom_post_types = apply_filters('wptouch_custom_posts_pre_get', array_merge(array('post'), $post_type_array));
                        $query->set('post_type', $custom_post_types);
                    }
                }
            }
        }
    }
    return $query;
}