/** * Template for Featured Header Image from theme options * * To override this in a child theme * simply create your own catchbase_featured_pagepost_image(), and that function will be used instead. * * @since Catch Base 1.0 */ function catchbase_featured_overall_image() { global $post, $wp_query; $options = catchbase_get_theme_options(); $defaults = catchbase_get_default_theme_options(); $enableheaderimage = $options['enable_featured_header_image']; // Get Page ID outside Loop $page_id = $wp_query->get_queried_object_id(); $page_for_posts = get_option('page_for_posts'); // Check Enable/Disable header image in Page/Post Meta box if (is_page() || is_single()) { //Individual Page/Post Image Setting $individual_featured_image = get_post_meta($post->ID, 'catchbase-header-image', true); if ($individual_featured_image == 'disable' || $individual_featured_image == 'default' && $enableheaderimage == 'disable') { echo '<!-- Page/Post Disable Header Image -->'; return; } elseif ($individual_featured_image == 'enable' && $enableheaderimage == 'disabled') { catchbase_featured_page_post_image(); } } // Check Homepage if ($enableheaderimage == 'homepage') { if (is_front_page() || is_home() && $page_for_posts != $page_id) { catchbase_featured_image(); } } // Check Excluding Homepage if ($enableheaderimage == 'exclude-home') { if (is_front_page() || is_home() && $page_for_posts != $page_id) { return false; } else { catchbase_featured_image(); } } elseif ($enableheaderimage == 'exclude-home-page-post') { if (is_front_page() || is_home() && $page_for_posts != $page_id) { return false; } elseif (is_page() || is_single()) { catchbase_featured_page_post_image(); } else { catchbase_featured_image(); } } elseif ($enableheaderimage == 'entire-site') { catchbase_featured_image(); } elseif ($enableheaderimage == 'entire-site-page-post') { if (is_page() || is_single()) { catchbase_featured_page_post_image(); } else { catchbase_featured_image(); } } elseif ($enableheaderimage == 'pages-posts') { if (is_page() || is_single()) { catchbase_featured_page_post_image(); } else { return false; } } else { echo '<!-- Disable Header Image -->'; } }
/** * Returns list of color keys of array with default values for each color scheme as index * * @since Catch Base Pro 3.0.2 */ function catchbase_color_list() { // Get default color scheme values $default = catchbase_get_default_theme_options(); // Get default dark color scheme valies $default_dark = catchbase_default_dark_color_options(); // Get coloy keys for menu $catchbase_menu_color_option = catchbase_get_menu_color_options(); // Get coloy keys for all other options except menu $catchbase_get_color_list = array_merge(catchbase_get_basic_color_options(), catchbase_get_header_color_options(), catchbase_get_content_color_options(), catchbase_get_sidebar_color_options(), catchbase_get_pagination_color_options(), catchbase_get_footer_color_options(), catchbase_get_promotion_headline_color_options(), catchbase_get_scrollup_color_options(), catchbase_get_slider_color_options(), catchbase_get_featured_content_color_options(), $catchbase_menu_color_option); // Set light and dark color keys with default values for each color scheme as index foreach ($catchbase_get_color_list as $color_option) { $lower_color_option = str_replace(array(' ', '/', '-'), '_', strtolower($color_option)); $catchbase_color_list[$lower_color_option]['light'] = $default[$lower_color_option]; $catchbase_color_list[$lower_color_option]['dark'] = $default_dark[$lower_color_option]; } //Add Secondary Menu Color Options foreach ($catchbase_menu_color_option as $color_option) { $lower_color_option = 'secondary_' . str_replace(' ', '_', strtolower($color_option)); $catchbase_color_list[$lower_color_option]['light'] = $default[$lower_color_option]; $catchbase_color_list[$lower_color_option]['dark'] = $default_dark[$lower_color_option]; //Add Header Right Menu Color Options $lower_color_option = 'header_right_' . str_replace(' ', '_', strtolower($color_option)); $catchbase_color_list[$lower_color_option]['light'] = $default[$lower_color_option]; $catchbase_color_list[$lower_color_option]['dark'] = $default_dark[$lower_color_option]; //Add Footer Menu Color Options $lower_color_option = 'footer_' . str_replace(' ', '_', strtolower($color_option)); $catchbase_color_list[$lower_color_option]['light'] = $default[$lower_color_option]; $catchbase_color_list[$lower_color_option]['dark'] = $default_dark[$lower_color_option]; } return $catchbase_color_list; }
/** * Returns list of color keys of array with default values for each color scheme as index * * @since Catch Base 2.1 */ function catchbase_color_list() { // Get default color scheme values $default = catchbase_get_default_theme_options(); // Get default dark color scheme valies $default_dark = catchbase_default_dark_color_options(); $catchbase_color_list['background_color']['light'] = $default['background_color']; $catchbase_color_list['background_color']['dark'] = $default_dark['background_color']; $catchbase_color_list['header_textcolor']['light'] = $default['header_textcolor']; $catchbase_color_list['header_textcolor']['dark'] = $default_dark['header_textcolor']; return $catchbase_color_list; }
/** * Enqueue Custon CSS * * @uses set_transient, wp_head, wp_enqueue_style * * @action wp_enqueue_scripts * * @since Catch Base 1.0 */ function catchbase_custom_css() { //catchbase_flush_transients(); $options = catchbase_get_theme_options(); $defaults = catchbase_get_default_theme_options(); if (!($catchbase_custom_css = get_transient('catchbase_custom_css'))) { $catchbase_custom_css = ''; // Has the text been hidden? if (!display_header_text()) { $catchbase_custom_css .= ".site-title a, .site-description { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px); }" . "\n"; } //Custom CSS Option if (!empty($options['custom_css'])) { $catchbase_custom_css .= $options['custom_css'] . "\n"; } if ('' != $catchbase_custom_css) { echo '<!-- refreshing cache -->' . "\n"; $catchbase_custom_css = '<!-- ' . get_bloginfo('name') . ' inline CSS Styles -->' . "\n" . '<style type="text/css" media="screen">' . "\n" . $catchbase_custom_css; $catchbase_custom_css .= '</style>' . "\n"; } set_transient('catchbase_custom_css', htmlspecialchars_decode($catchbase_custom_css), 86940); } echo $catchbase_custom_css; }
/** * Reset all settings to default * @param $input entered value * @return sanitized output * * @since Catch Base 1.0 */ function catchbase_reset_all_settings($input) { if ($input == 1) { // Set default values set_theme_mod('catchbase_theme_options', catchbase_get_default_theme_options()); // Flush out all transients on reset catchbase_flush_transients(); } else { return ''; } }
/** * Footer Text * * @get footer text from theme options and display them accordingly * @display footer_text * @action catchbase_footer * * @since Catch Base 1.0 */ function catchbase_footer_content() { //catchbase_flush_transients(); if (!($catchbase_footer_content = get_transient('catchbase_footer_content'))) { echo '<!-- refreshing cache -->'; // get the data value from theme options $options = catchbase_get_theme_options(); $defaults = catchbase_get_default_theme_options(); $search = array('[the-year]', '[site-link]'); $replace = array(date('Y'), '<a href="' . esc_url(home_url('/')) . '">' . esc_attr(get_bloginfo('name', 'display')) . '</a>'); $options['footer_left_content'] = str_replace($search, $replace, $options['footer_left_content']); if (!$options['reset_footer_content']) { $footer_left_content = isset($options['footer_left_content']) ? $options['footer_left_content'] : ''; $footer_right_content = isset($options['footer_right_content']) ? $options['footer_right_content'] : ''; } else { $footer_left_content = $defaults['footer_left_content']; $footer_right_content = $defaults['footer_right_content']; } if (empty($footer_left_content) && empty($footer_right_content)) { return false; } else { if (!empty($footer_left_content) && !empty($footer_right_content)) { $class = "two"; } else { $class = "one"; } $catchbase_footer_content .= ' <div id="site-generator" class="' . $class . '"> <div class="wrapper">'; if (!empty($footer_left_content)) { $catchbase_footer_content .= '<div id="footer-left-content" class="copyright">' . $footer_left_content . '</div>'; } if (!empty($footer_right_content)) { $catchbase_footer_content .= '<div id="footer-right-content" class="powered">' . $footer_right_content . '</div>'; } $catchbase_footer_content .= ' </div><!-- .wrapper --> </div><!-- #site-generator -->'; set_transient('catchbase_footer_content', $catchbase_footer_content, 86940); } } echo $catchbase_footer_content; }