コード例 #1
0
ファイル: helpers.php プロジェクト: SeamlessThemes/seamless
/**
 * Create a simple array of the available layout strings
 *
 * @since 2.0
 *
 * @return array $layouts
 */
function seamless_available_layout_slugs()
{
    $possible_layouts = seamless_available_theme_layouts();
    $available_layouts = array();
    foreach ($possible_layouts as $layout) {
        $available_layouts[] = $layout['slug'];
    }
    return $available_layouts;
}
コード例 #2
0
 function test_seamless_remove_available_layout()
 {
     add_filter('seamless_available_theme_layouts', array($this, 'remove_layout'));
     $available_layouts = apply_filters('seamless_available_theme_layouts', seamless_available_theme_layouts());
     $this->assertArrayNotHasKey('right-sidebar', $available_layouts);
 }
コード例 #3
0
    // Add postMessage support for site title and description.
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    // Get the default seamless footer text
    $seamless_defaults = seamless_default_opt();
    $seamless_default_footertext = $seamless_defaults['footer_txt'];
    $seamless_default_layout = $seamless_defaults['layout'];
    /**
     * Filter to show or hide the layout section from the Theme Customizer
     * 
     * @param bool true Default is showing the section
     */
    if (apply_filters('seamless_show_customizer_layoutsection', true) && !seamless_is_legacy_xhtml()) {
        $wp_customize->add_section('seamless_layout', array('title' => __('Layout', 'seamless'), 'description' => __('Choose the main layout of your theme', 'seamless'), 'capability' => 'edit_theme_options', 'priority' => '90'));
        $wp_customize->add_setting('seamless_theme_opt[layout]', array('default' => $seamless_default_layout, 'type' => 'option'));
        $possible_layouts = seamless_available_theme_layouts();
        $available_layouts = array();
        foreach ($possible_layouts as $layout) {
            $available_layouts[$layout['slug']] = $layout['title'];
        }
        $wp_customize->add_control('seamless_layout_control', array('type' => 'radio', 'label' => __('Theme layout', 'seamless'), 'section' => 'seamless_layout', 'choices' => $available_layouts, 'settings' => 'seamless_theme_opt[layout]'));
    }
    // Add section for seamless footer options
    $wp_customize->add_section('seamless_footer_text', array('title' => __('Footer', 'seamless'), 'description' => sprintf(_x('You can use HTML in your footer text.', '%s are shortcode tags', 'seamless')), 'priority' => 135));
    // Add setting for footer text
    $wp_customize->add_setting('seamless_theme_opt[footer_txt]', array('default' => $seamless_default_footertext, 'type' => 'option', 'capability' => 'edit_theme_options', 'transport' => 'refresh'));
    // Add control for footer text
    $wp_customize->add_control(new Distilled_Customize_Textarea_Control($wp_customize, 'seamless_theme_opt[footer_txt]', array('label' => __('Footer text', 'seamless'), 'section' => 'seamless_footer_text', 'type' => 'textarea', 'settings' => 'seamless_theme_opt[footer_txt]')));
}
add_action('customize_register', 'seamless_customize_register');
/**