/** * Enqueue Custon CSS * * @uses set_transient, wp_head, wp_enqueue_style * * @action wp_enqueue_scripts * * @since Catch Adaptive 0.1 */ function catchadaptive_custom_css() { //catchadaptive_flush_transients(); $options = catchadaptive_get_theme_options(); $defaults = catchadaptive_get_default_theme_options(); if (!($catchadaptive_custom_css = get_transient('catchadaptive_custom_css'))) { $catchadaptive_custom_css = ''; $text_color = get_header_textcolor(); if ('blank' == $text_color) { $catchadaptive_custom_css .= ".site-title a, .site-description { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px); }" . "\n"; } elseif (HEADER_TEXTCOLOR != $text_color) { $catchadaptive_custom_css .= ".site-title a, .site-title a:hover, .site-description { color: #" . $text_color . "; }" . "\n"; } // Featured Content Background Image Options if ($defaults['featured_content_background_image'] != $options['featured_content_background_image']) { $catchadaptive_custom_css .= "#featured-content {" . "\n"; $catchadaptive_custom_css .= "background-image: url(\"" . esc_url($options['featured_content_background_image']) . "\");" . "\n"; $catchadaptive_custom_css .= "}"; } //Custom CSS Option if (!empty($options['custom_css'])) { $catchadaptive_custom_css .= $options['custom_css'] . "\n"; } if ('' != $catchadaptive_custom_css) { echo '<!-- refreshing cache -->' . "\n"; $catchadaptive_custom_css = '<!-- ' . get_bloginfo('name') . ' inline CSS Styles -->' . "\n" . '<style type="text/css" media="screen">' . "\n" . $catchadaptive_custom_css; $catchadaptive_custom_css .= '</style>' . "\n"; } set_transient('catchadaptive_custom_css', htmlspecialchars_decode($catchadaptive_custom_css), 86940); } echo $catchadaptive_custom_css; }
/** * Reset all settings to default * @param $input entered value * @return sanitized output * * @since Catch Adaptive 0.1 */ function catchadaptive_reset_all_settings($input) { if ($input == 1) { // Set default values set_theme_mod('catchadaptive_theme_options', catchadaptive_get_default_theme_options()); // Flush out all transients catchadaptive_flush_transients(); } else { return ''; } }
/** * Template for Featured Header Image from theme options * * To override this in a child theme * simply create your own catchadaptive_featured_overall_image(), and that function will be used instead. * * @since Catch Adaptive 0.1 */ function catchadaptive_featured_overall_image() { global $post, $wp_query; $options = catchadaptive_get_theme_options(); $defaults = catchadaptive_get_default_theme_options(); $enableheaderimage = $options['enable_featured_header_image']; $header_image = get_header_image(); $singlularimage = catchadaptive_featured_page_post_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, 'catchadaptive-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') { $catchadaptive_featured_overall_image = catchadaptive_featured_page_post_image(); } } // Check Homepage if ($enableheaderimage == 'homepage') { if (is_front_page() || is_home() && $page_for_posts != $page_id) { $catchadaptive_featured_overall_image = esc_url($header_image); } } // Check Excluding Homepage if ($enableheaderimage == 'exclude-home') { if (is_front_page() || is_home() && $page_for_posts != $page_id) { return false; } else { $catchadaptive_featured_overall_image = esc_url($header_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()) { $catchadaptive_featured_overall_image = catchadaptive_featured_page_post_image(); } else { $catchadaptive_featured_overall_image = esc_url($header_image); } } elseif ($enableheaderimage == 'entire-site') { $catchadaptive_featured_overall_image = esc_url($header_image); } elseif ($enableheaderimage == 'entire-site-page-post') { if (is_page() || is_single()) { $catchadaptive_featured_overall_image = catchadaptive_featured_page_post_image(); } else { $catchadaptive_featured_overall_image = esc_url($header_image); } } elseif ($enableheaderimage == 'pages-posts') { if (is_page() || is_single()) { $catchadaptive_featured_overall_image = catchadaptive_featured_page_post_image(); } else { return false; } } else { return false; } return $catchadaptive_featured_overall_image; }