Example #1
0
/**
 * Adds two classes to the array of body classes.
 * The first is if the site has only had one author with published posts.
 * The second is if a singular post being displayed
 *
 * @since Catch Box 1.0
 */
function catchbox_body_classes( $classes ) {
	$options = catchbox_get_theme_options();
	$layout = $options['theme_layout'];
	if ( function_exists( 'is_multi_author' ) && !is_multi_author() ) {
		$classes[] = 'single-author';
	}
	if ( $layout == 'content-sidebar' && !is_page_template( 'page-disable-sidebar.php' ) && !is_page_template( 'page-fullwidth.php' )  && !is_page_template( 'page-onecolumn.php' ) ) {
		$classes[] = 'content-sidebar';
	}
	elseif ( $layout == 'sidebar-content' && !is_page_template( 'page-disable-sidebar.php' ) && !is_page_template( 'page-fullwidth.php' )  && !is_page_template( 'page-onecolumn.php' ) ) {
		$classes[] = 'sidebar-content';
	}
	elseif ( $layout == 'content-onecolumn' || is_page_template( 'page-onecolumn.php' ) && !is_page_template( 'page-disable-sidebar.php' ) && !is_page_template( 'page-fullwidth.php' ) ) {
		$classes[] = 'content-onecolumn';
	}	
	elseif ( is_page_template( 'page-disable-sidebar.php' ) || is_attachment() ) {
		$classes[] = 'singular';
	}
	elseif ( is_page_template( 'page-fullwidth.php' ) || is_attachment() ) {
		$classes[] = 'fullwidth';	
	}	
	return $classes;
}
/**
 * Implements Catch Kathmandu theme options into Theme Customizer.
 *
 * @param $wp_customize Theme Customizer object
 * @return void
 *
 * @since Catch Box 3.6.7
 */
function catchbox_customize_register($wp_customize)
{
    $options = catchbox_get_theme_options();
    $defaults = catchbox_get_default_theme_options();
    //print_r($options);
    //Custom Controls
    require get_template_directory() . '/inc/customizer/customizer-custom-controls.php';
    $theme_slug = 'catchbox_theme_';
    $settings_page_tabs = array('theme_options' => array('id' => 'theme_options', 'title' => __('Theme Options', 'catch-box'), 'description' => __('Basic theme Options', 'catch-box'), 'sections' => array('favicon' => array('id' => 'favicon', 'title' => __('Favicon', 'catch-box'), 'description' => ''), 'web_clip_icon_options' => array('id' => 'web_clip_icon_options', 'title' => __('Webclip Icon Options', 'catch-box'), 'description' => __('Web Clip Icon for Apple devices. Recommended Size - Width 144px and Height 144px height, which will support High Resolution Devices like iPad Retina', 'catch-box')), 'color_scheme' => array('id' => 'color_scheme', 'title' => __('Color Scheme', 'catch-box'), 'description' => ''), 'link_color' => array('id' => 'link_color', 'title' => __('Link Color', 'catch-box'), 'description' => ''), 'theme_layout' => array('id' => 'theme_layout', 'title' => __('Default Layout', 'catch-box'), 'description' => ''), 'content_layout' => array('id' => 'content_layout', 'title' => __('Content Layout', 'catch-box'), 'description' => ''), 'excerpt_length' => array('id' => 'excerpt_length', 'title' => __('Excerpt Length in Words', 'catch-box'), 'description' => ''), 'feed_url' => array('id' => 'feed_url', 'title' => __('Feed Redirect URL', 'catch-box'), 'description' => ''), 'site_title_above' => array('id' => 'site_title_above', 'title' => __('Move Site Title and Tagline?', 'catch-box'), 'description' => ''), 'search_display_text' => array('id' => 'search_display_text', 'title' => __('Default Display Text in Search', 'catch-box'), 'description' => ''), 'disable_header_search' => array('id' => 'disable_header_search', 'title' => __('Disable Search in Header?', 'catch-box'), 'description' => ''), 'enable_menus' => array('id' => 'enable_menus', 'title' => __('Enable Secondary & Footer Menu in Mobile Devices?', 'catch-box'), 'description' => ''), 'custom_css' => array('id' => 'custom_css', 'title' => __('Custom CSS Styles', 'catch-box'), 'description' => ''), 'scrollup' => array('id' => 'scrollup', 'title' => __('Scroll Up Options', 'catch-box'), 'description' => ''))), 'featured_slider' => array('id' => 'featured_slider', 'title' => __('Featured Slider', 'catch-box'), 'description' => __('Featured Slider', 'catch-box'), 'sections' => array('slider_options' => array('id' => 'slider_options', 'title' => __('Slider Options', 'catch-box'), 'description' => ''), 'slider_effect_options' => array('id' => 'slider_effect_options', 'title' => __('Slider Effect Options', 'catch-box'), 'description' => ''))), 'social_links' => array('id' => 'social_links', 'title' => __('Social Links', 'catch-box'), 'description' => __('Add your social links here', 'catch-box'), 'sections' => array('predefined_social_icons' => array('id' => 'predefined_social_icons', 'title' => __('Predefined Social Icons', 'catch-box'), 'description' => ''))), 'webmaster_tools' => array('id' => 'webmaster_tools', 'title' => __('Webmaster Tools', 'catch-box'), 'description' => sprintf(__('Webmaster Tools falls under Plugins Territory according to Theme Review Guidelines in WordPress.org. This feature will be depreciated in future versions from Catch Box free version. If you want this feature, then you can add <a href="%s">Catch Web Tools</a>  plugin.', 'catch-box'), esc_url('https://wordpress.org/plugins/catch-web-tools/')), 'sections' => array('webmaster_tools' => array('id' => 'webmaster_tools', 'title' => __('Webmaster Tools', 'catch-box'), 'description' => sprintf(__('Webmaster Tools falls under Plugins Territory according to Theme Review Guidelines in WordPress.org. This feature will be depreciated in future versions from Catch Box free version. If you want this feature, then you can add <a href="%s">Catch Web Tools</a>  plugin.', 'catch-box'), esc_url('https://wordpress.org/plugins/catch-web-tools/'))))));
    //Add Panels and sections
    foreach ($settings_page_tabs as $panel) {
        $wp_customize->add_panel($theme_slug . $panel['id'], array('priority' => 200, 'capability' => 'edit_theme_options', 'title' => $panel['title'], 'description' => $panel['description']));
        // Loop through tabs for sections
        foreach ($panel['sections'] as $section) {
            $params = array('title' => $section['title'], 'description' => $section['description'], 'panel' => $theme_slug . $panel['id']);
            if (isset($section['active_callback'])) {
                $params['active_callback'] = $section['active_callback'];
            }
            $wp_customize->add_section($theme_slug . $section['id'], $params);
        }
    }
    foreach (catchbox_color_schemes() as $option) {
        $catchbox_color_schemes[$option['value']] = $option['label'];
    }
    foreach (catchbox_layouts() as $option) {
        $catchbox_theme_layout[$option['value']] = $option['label'];
    }
    foreach (catchbox_content_layout() as $option) {
        $catchbox_content_layout[$option['value']] = $option['label'];
    }
    $settings_parameters = array('fav_icon' => array('id' => 'fav_icon', 'title' => __('Fav Icon', 'catch-box'), 'description' => '', 'field_type' => 'image', 'sanitize' => 'catchbox_sanitize_image', 'panel' => 'theme_options', 'section' => 'favicon', 'default' => '', 'active_callback' => 'catchbox_is_site_icon_active'), 'web_clip' => array('id' => 'web_clip', 'title' => __('Web Clip Icon', 'catch-box'), 'description' => '', 'field_type' => 'image', 'sanitize' => 'catchbox_sanitize_image', 'panel' => 'theme_options', 'section' => 'web_clip_icon_options', 'default' => '', 'active_callback' => 'catchbox_is_site_icon_active'), 'color_scheme' => array('id' => 'color_scheme', 'title' => __('Color Scheme', 'catch-box'), 'description' => '', 'field_type' => 'radio', 'sanitize' => 'catchbox_sanitize_select', 'panel' => 'theme_options', 'section' => 'color_scheme', 'default' => $defaults['color_scheme'], 'choices' => $catchbox_color_schemes), 'link_color' => array('id' => 'link_color', 'title' => __('Link Color', 'catch-box'), 'description' => '', 'field_type' => 'color', 'sanitize' => 'sanitize_hex_color', 'panel' => 'theme_options', 'section' => 'link_color', 'default' => $defaults['link_color']), 'theme_layout' => array('id' => 'theme_layout', 'title' => __('Default Layout', 'catch-box'), 'description' => '', 'field_type' => 'radio', 'sanitize' => 'catchbox_sanitize_select', 'panel' => 'theme_options', 'section' => 'theme_layout', 'default' => $defaults['theme_layout'], 'choices' => $catchbox_theme_layout), 'content_layout' => array('id' => 'content_layout', 'title' => __('Content Layout', 'catch-box'), 'description' => '', 'field_type' => 'radio', 'sanitize' => 'catchbox_sanitize_select', 'panel' => 'theme_options', 'section' => 'content_layout', 'default' => $defaults['content_layout'], 'choices' => $catchbox_content_layout), 'excerpt_length' => array('id' => 'excerpt_length', 'title' => __('Excerpt Length in Words', 'catch-box'), 'description' => '', 'field_type' => 'number', 'sanitize' => 'catchbox_sanitize_number_range', 'panel' => 'theme_options', 'section' => 'excerpt_length', 'default' => $defaults['excerpt_length'], 'input_attrs' => array('style' => 'width: 45px;', 'min' => 0, 'max' => 999999, 'step' => 1)), 'feed_url' => array('id' => 'feed_url', 'title' => __('Feed Redirect url', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'esc_url_raw', 'panel' => 'social_links', 'section' => 'feed_url', 'default' => '', 'active_callback' => 'catchbox_is_feed_url_present'), 'site_title_above' => array('id' => 'site_title_above', 'title' => __('Check to move above the Header/Logo Image', 'catch-box'), 'field_type' => 'checkbox', 'sanitize' => 'catchbox_sanitize_checkbox', 'panel' => 'theme_options', 'section' => 'site_title_above', 'default' => $defaults['site_title_above']), 'search_display_text' => array('id' => 'search_display_text', 'title' => __('Default Display Text in Search', 'catch-box'), 'description' => '', 'field_type' => 'text', 'sanitize' => 'sanitize_text_field', 'panel' => 'theme_options', 'section' => 'search_display_text', 'default' => $defaults['search_display_text']), 'disable_header_search' => array('id' => 'disable_header_search', 'title' => __('Check to Disable', 'catch-box'), 'field_type' => 'checkbox', 'sanitize' => 'catchbox_sanitize_checkbox', 'panel' => 'theme_options', 'section' => 'disable_header_search', 'default' => $defaults['disable_header_search']), 'enable_menus' => array('id' => 'enable_menus', 'title' => __('Check to Enable', 'catch-box'), 'field_type' => 'checkbox', 'sanitize' => 'catchbox_sanitize_checkbox', 'panel' => 'theme_options', 'section' => 'enable_menus', 'default' => $defaults['enable_menus']), 'custom_css' => array('id' => 'custom_css', 'title' => __('Custom CSS Styles', 'catch-box'), 'description' => '', 'field_type' => 'textarea', 'sanitize' => 'catchbox_sanitize_custom_css', 'panel' => 'theme_options', 'section' => 'custom_css', 'default' => ''), 'disable_scrollup' => array('id' => 'disable_scrollup', 'title' => __('Check to disable scroll up', 'catch-box'), 'description' => '', 'field_type' => 'checkbox', 'sanitize' => 'catchbox_sanitize_checkbox', 'panel' => 'theme_options', 'section' => 'scrollup', 'default' => $defaults['disable_scrollup']), 'exclude_slider_post' => array('id' => 'exclude_slider_post', 'title' => __('Check to Exclude Slider posts from Homepage posts', 'catch-box'), 'field_type' => 'checkbox', 'sanitize' => 'catchbox_sanitize_checkbox', 'panel' => 'featured_slider', 'section' => 'slider_options', 'default' => $defaults['exclude_slider_post']), 'slider_qty' => array('id' => 'slider_qty', 'title' => __('Number of Slides', 'catch-box'), 'description' => __('Customizer page needs to be refreshed after saving if number of slides is changed', 'catch-box'), 'field_type' => 'number', 'sanitize' => 'catchbox_sanitize_number_range', 'panel' => 'featured_slider', 'section' => 'slider_options', 'default' => $defaults['slider_qty'], 'input_attrs' => array('style' => 'width: 45px;', 'min' => 0, 'max' => 20, 'step' => 1)), 'transition_effect' => array('id' => 'transition_effect', 'title' => __('Transition Effect', 'catch-box'), 'description' => '', 'field_type' => 'select', 'sanitize' => 'catchbox_sanitize_select', 'panel' => 'featured_slider', 'section' => 'slider_effect_options', 'default' => $defaults['transition_effect'], 'choices' => array('fade' => __('fade', 'catch-box'), 'wipe' => __('wipe', 'catch-box'), 'scrollUp' => __('scrollUp', 'catch-box'), 'scrollDown' => __('scrollDown', 'catch-box'), 'scrollLeft' => __('scrollLeft', 'catch-box'), 'scrollRight' => __('scrollRight', 'catch-box'), 'blindX' => __('blindX', 'catch-box'), 'blindY' => __('blindY', 'catch-box'), 'blindZ' => __('blindZ', 'catch-box'), 'cover' => __('cover', 'catch-box'), 'shuffle' => __('shuffle', 'catch-box'))), 'transition_delay' => array('id' => 'transition_delay', 'title' => __('Transition Delay (in seconds)', 'catch-box'), 'description' => '', 'field_type' => 'number', 'sanitize' => 'catchbox_sanitize_number_range', 'panel' => 'featured_slider', 'section' => 'slider_effect_options', 'default' => $defaults['transition_delay'], 'input_attrs' => array('style' => 'width: 45px;', 'min' => 0, 'max' => 999999999, 'step' => 1)), 'transition_duration' => array('id' => 'transition_duration (in seconds)', 'title' => __('Transition Length', 'catch-box'), 'description' => '', 'field_type' => 'number', 'sanitize' => 'catchbox_sanitize_number_range', 'panel' => 'featured_slider', 'section' => 'slider_effect_options', 'default' => $defaults['transition_duration'], 'input_attrs' => array('style' => 'width: 45px;', 'min' => 0, 'max' => 999999999, 'step' => 1)), 'social_facebook' => array('id' => 'social_facebook', 'title' => __('Facebook', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'esc_url_raw', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'social_twitter' => array('id' => 'social_twitter', 'title' => __('Twitter', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'esc_url_raw', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'social_googleplus' => array('id' => 'social_googleplus', 'title' => __('Google+', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'esc_url_raw', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'social_linkedin' => array('id' => 'social_linkedin', 'title' => __('LinkedIn', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'esc_url_raw', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'social_pinterest' => array('id' => 'social_pinterest', 'title' => __('Pinterest', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'esc_url_raw', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'social_youtube' => array('id' => 'social_youtube', 'title' => __('Youtube', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'esc_url_raw', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'social_rss' => array('id' => 'social_rss', 'title' => __('RSS', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'esc_url_raw', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'social_deviantart' => array('id' => 'social_deviantart', 'title' => __('deviantART', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'esc_url_raw', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'social_tumblr' => array('id' => 'social_tumblr', 'title' => __('Tumblr', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'esc_url_raw', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'social_vimeo' => array('id' => 'social_vimeo', 'title' => __('Vimeo', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'esc_url_raw', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'social_dribbble' => array('id' => 'social_dribbble', 'title' => __('Dribbble', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'esc_url_raw', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'social_myspace' => array('id' => 'social_myspace', 'title' => __('MySpace', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'esc_url_raw', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'social_aim' => array('id' => 'social_aim', 'title' => __('Aim', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'esc_url_raw', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'social_flickr' => array('id' => 'social_flickr', 'title' => __('Flickr', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'sanitize_email', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'social_slideshare' => array('id' => 'social_slideshare', 'title' => __('Slideshare', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'esc_url_raw', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'social_instagram' => array('id' => 'social_instagram', 'title' => __('Flickr', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'esc_url_raw', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'social_skype' => array('id' => 'social_skype', 'title' => __('Skype', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'sanitize_text_field', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'social_soundcloud' => array('id' => 'social_soundcloud', 'title' => __('Soundcloud', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'esc_url_raw', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'social_email' => array('id' => 'social_email', 'title' => __('Email', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'sanitize_email', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'social_xing' => array('id' => 'social_xing', 'title' => __('Xing', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'esc_url_raw', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'social_meetup' => array('id' => 'social_meetup', 'title' => __('Meetup', 'catch-box'), 'description' => '', 'field_type' => 'url', 'sanitize' => 'esc_url_raw', 'panel' => 'social_links', 'section' => 'predefined_social_icons', 'default' => ''), 'tracker_header' => array('id' => 'tracker_header', 'title' => __('Code to display on Header', 'catch-box'), 'description' => __('Here you can put scripts from Google, Facebook etc. which will load on Header', 'catch-box'), 'field_type' => 'textarea', 'sanitize' => 'wp_kses_stripslashes', 'panel' => 'webmaster_tools', 'section' => 'webmaster_tools', 'active_callback' => 'catchbox_is_header_code_present', 'default' => ''), 'tracker_footer' => array('id' => 'tracker_footer', 'title' => __('Code to display on Footer', 'catch-box'), 'description' => __('Here you can put scripts from Google, Facebook etc. which will load on Footer', 'catch-box'), 'field_type' => 'textarea', 'sanitize' => 'wp_kses_stripslashes', 'panel' => 'webmaster_tools', 'section' => 'webmaster_tools', 'active_callback' => 'catchbox_is_footer_code_present', 'default' => ''));
    foreach ($settings_parameters as $option) {
        if ('image' == $option['field_type']) {
            $wp_customize->add_setting($theme_slug . 'options[' . $option['id'] . ']', array('type' => 'option', 'sanitize_callback' => $option['sanitize'], 'default' => $option['default']));
            $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, $theme_slug . 'options[' . $option['id'] . ']', array('label' => $option['title'], 'section' => $theme_slug . $option['section'], 'settings' => $theme_slug . 'options[' . $option['id'] . ']', 'active_callback' => $option['active_callback'])));
        } else {
            if ('checkbox' == $option['field_type']) {
                $wp_customize->add_setting($theme_slug . 'options[' . $option['id'] . ']', array('type' => 'option', 'sanitize_callback' => $option['sanitize'], 'default' => $option['default']));
                $params = array('label' => $option['title'], 'settings' => $theme_slug . 'options[' . $option['id'] . ']', 'name' => $theme_slug . 'options[' . $option['id'] . ']', 'section' => $theme_slug . $option['section']);
                if (isset($option['active_callback'])) {
                    $params['active_callback'] = $option['active_callback'];
                }
                $wp_customize->add_control(new CatchBox_Customize_Checkbox($wp_customize, $theme_slug . 'options[' . $option['id'] . ']', $params));
            } else {
                //Normal Loop
                $wp_customize->add_setting($theme_slug . 'options[' . $option['id'] . ']', array('default' => $option['default'], 'type' => 'option', 'sanitize_callback' => $option['sanitize']));
                // Add setting control
                $params = array('label' => $option['title'], 'settings' => $theme_slug . 'options[' . $option['id'] . ']', 'type' => $option['field_type'], 'description' => $option['description'], 'section' => $theme_slug . $option['section']);
                if (isset($option['active_callback'])) {
                    $params['active_callback'] = $option['active_callback'];
                }
                if (isset($option['choices'])) {
                    $params['choices'] = $option['choices'];
                }
                if (isset($option['active_callback'])) {
                    $params['active_callback'] = $option['active_callback'];
                }
                if (isset($option['input_attrs'])) {
                    $params['input_attrs'] = $option['input_attrs'];
                }
                $wp_customize->add_control($theme_slug . 'options[' . $option['id'] . ']', $params);
            }
        }
    }
    if (!isset($options['slider_qty']) || !is_numeric($options['slider_qty'])) {
        $options['slider_qty'] = 4;
    }
    //Add featured post elements with respect to no of featured sliders
    for ($i = 1; $i <= $options['slider_qty']; $i++) {
        $wp_customize->add_setting($theme_slug . 'options[featured_slider][' . $i . ']', array('type' => 'option', 'sanitize_callback' => 'catchbox_sanitize_post_id'));
        $wp_customize->add_control($theme_slug . 'options[featured_slider][' . $i . ']', array('label' => sprintf(__('#%s Featured Post ID', 'catch-box'), $i), 'section' => $theme_slug . 'slider_options', 'settings' => $theme_slug . 'options[featured_slider][' . $i . ']', 'type' => 'text', 'input_attrs' => array('style' => 'width: 100px;')));
    }
    // Reset all settings to default
    $wp_customize->add_section('catchbox_reset_all_settings', array('description' => __('Caution: Reset all settings to default. Refresh the page after save to view full effects.', 'catch-box'), 'priority' => 700, 'title' => __('Reset all settings', 'catch-box')));
    $wp_customize->add_setting('catchbox_theme_options[reset_all_settings]', array('capability' => 'edit_theme_options', 'sanitize_callback' => 'catchbox_reset_all_settings', 'transport' => 'postMessage'));
    $wp_customize->add_control('catchbox_theme_options[reset_all_settings]', array('label' => __('Check to reset all settings to default', 'catch-box'), 'section' => 'catchbox_reset_all_settings', 'settings' => 'catchbox_theme_options[reset_all_settings]', 'type' => 'checkbox'));
    // Reset all settings to default end
    //Important Links
    $wp_customize->add_section('important_links', array('priority' => 999, 'title' => __('Important Links', 'catch-box')));
    /**
     * Has dummy Sanitizaition function as it contains no value to be sanitized
     */
    $wp_customize->add_setting('important_links', array('sanitize_callback' => 'catchbox_sanitize_important_link'));
    $wp_customize->add_control(new CatchBox_Important_Links($wp_customize, 'important_links', array('label' => __('Important Links', 'catch-box'), 'section' => 'important_links', 'settings' => 'important_links', 'type' => 'important_links')));
    //Important Links End
}
Example #3
0
/**
 * Add a style block to the theme for the current link color.
 *
 * This function is attached to the wp_head action hook.
 *
 * @since Catch Box 1.0
 */
function catchbox_print_link_color_style()
{
    $options = catchbox_get_theme_options();
    $link_color = $options['link_color'];
    $default_options = catchbox_get_default_theme_options();
    // Don't do anything if the current link color is the default.
    if ($default_options['link_color'] == $link_color) {
        return;
    }
    ?>
	<style>
		/* Link color */
		a,
		#site-title a:focus,
		#site-title a:hover,
		#site-title a:active,
		.entry-title a:hover,
		.entry-title a:focus,
		.entry-title a:active,
		.widget_catchbox_ephemera .comments-link a:hover,
		section.recent-posts .other-recent-posts a[rel="bookmark"]:hover,
		section.recent-posts .other-recent-posts .comments-link a:hover,
		.format-image footer.entry-meta a:hover,
		#site-generator a:hover {
			color: <?php 
    echo $link_color;
    ?>
;
		}
		section.recent-posts .other-recent-posts .comments-link a:hover {
			border-color: <?php 
    echo $link_color;
    ?>
;
		}
		article.feature-image.small .entry-summary p a:hover,
		.entry-header .comments-link a:hover,
		.entry-header .comments-link a:focus,
		.entry-header .comments-link a:active,
		.feature-slider a.active {
			background-color: <?php 
    echo $link_color;
    ?>
;
		}
	</style>
<?php 
}
Example #4
0
                        <span class="comments-link">
                         	<?php 
        comments_popup_link(__('No Comments &darr;', 'catchbox'), __('1 Comment &darr;', 'catchbox'), __('% Comments &darr;', 'catchbox'));
        ?>
                        </span>
                    <?php 
    }
    ?>
                </div><!-- .entry-meta -->
			<?php 
}
?>
		</header><!-- .entry-header -->
        	
		 <?php 
$options = catchbox_get_theme_options();
$current_content_layout = $options['content_layout'];
$catchbox_excerpt = get_the_excerpt();
if (is_search()) {
    // Only display Excerpts for Search
    ?>
            <div class="entry-summary">
                <?php 
    the_excerpt();
    ?>
            </div><!-- .entry-summary -->
        <?php 
} elseif ($current_content_layout == 'excerpt' && !empty($catchbox_excerpt)) {
    // Only display Featured Image and Excerpts if checked in Theme Option
    ?>
            <div class="entry-summary">
 /**
  * Header Search Box
  *
  * @since Catch Box 2.5
  */
 function catchbox_header_search()
 {
     // Getting data from Theme Options
     $options = catchbox_get_theme_options();
     if ($options['disable_header_search'] == 0) {
         get_search_form();
     }
 }
/**
 * Function to migrate data from theme options to theme customizer
 *
 * @hooked after_setup_theme
 */
function catchbox_migrate_theme_options()
{
    // Combine slider options with theme options
    if ($catchbox_options_slider = get_option('catchbox_options_slider')) {
        $catchbox_theme_options = catchbox_get_theme_options();
        $catchbox_theme_options = array_merge($catchbox_theme_options, $catchbox_options_slider);
        update_option('catchbox_theme_options', $catchbox_theme_options);
        delete_option('catchbox_options_slider');
    }
    // Combine social links options with theme options
    if ($catchbox_options_social_links = get_option('catchbox_options_social_links')) {
        $catchbox_theme_options = catchbox_get_theme_options();
        $catchbox_theme_options = array_merge($catchbox_theme_options, $catchbox_options_social_links);
        update_option('catchbox_theme_options', $catchbox_theme_options);
        delete_option('catchbox_options_social_links');
    }
    // Combine webmaster options with theme options
    if ($catchbox_options_webmaster = get_option('catchbox_options_webmaster')) {
        $catchbox_theme_options = catchbox_get_theme_options();
        $catchbox_theme_options = array_merge($catchbox_theme_options, $catchbox_options_webmaster);
        update_option('catchbox_theme_options', $catchbox_theme_options);
        delete_option('catchbox_options_webmaster');
    }
}
 /**
  * Return true if footer code is present
  *
  * @since Catch Box 3.6.7
  */
 function catchbox_is_footer_code_present($control)
 {
     $options = catchbox_get_theme_options();
     return isset($options['tracker_footer']) && '' != $options['tracker_footer'];
 }
    /**
     * This function loads Footer Mobile Menus in Footer Section
     *
     * @get the data value from theme options
     * @uses catchbox_footer_menu action to add in the Header
     */
    function catchbox_mobile_footer_menu()
    {
        //Getting Ready to load options data
        $options = catchbox_get_theme_options();
        if (!empty($options['enable_menus']) && has_nav_menu('footer')) {
            ?>
        <div class="menu-access-wrap clearfix">
            <div id="mobile-footer-menu" class="mobile-menu-anchor footer-menu">
                <a href="#mobile-footer-nav" id="footer-menu" class="genericon genericon-menu">
                    <span class="mobile-menu-text"><?php 
            _e('Footer Menu', 'catch-box');
            ?>
</span>
                </a>
            </div><!-- #mobile-footer-menu -->
            <?php 
            echo '<nav id="mobile-footer-nav" class="mobile-menu" role="navigation" aria-label="' . esc_attr__('Secondary Mobile Menu', 'catch-box') . '">';
            $args = array('theme_location' => 'footer', 'container' => false, 'items_wrap' => '<ul id="footer-nav" class="menu">%3$s</ul>');
            wp_nav_menu($args);
            echo '</nav><!-- #mobile-footer-nav -->';
            ?>
        </div><!-- .menu-access-wrap -->  
        <?php 
        }
    }
Example #9
0
/**
 * Redirect WordPress Feeds To FeedBurner
 */
function catchbox_rss_redirect()
{
    $options = catchbox_get_theme_options();
    if (!empty($options['feed_url'])) {
        $url = 'Location: ' . $options['feed_url'];
        if (is_feed() && !preg_match('/feedburner|feedvalidator/i', $_SERVER['HTTP_USER_AGENT'])) {
            header($url);
            header('HTTP/1.1 302 Temporary Redirect');
        }
    }
}