build(); if (!empty($css)) { echo "\n\n\n\n"; } } endif; add_action('wp_head', 'avish_customizer_styles', 11); if (!function_exists('avish_custom_feed_url')) : /** * Custom RSS feed url. * * @since 1.0.0 */ function avish_custom_feed_url($output, $feed) { // Get the custom rss feed url $url = avish_mod(PREFIX . 'custom-rss'); // Do not redirect comments feed if (strpos($output, 'comments')) { return $output; } // Check the settings. if (!empty($url)) { $output = esc_url($url); } return $output; } endif; add_filter('feed_link', 'avish_custom_feed_url', 10, 2); /** * Display the custom header. * * @since 1.0.0 */ function avish_custom_header() { // Get the custom header. $header = get_header_image(); // Display the custom header via inline CSS. if ($header) : $header_css = ' .site-branding { background-image: url("' . esc_url($header) . '"); background-repeat: no-repeat; background-position: center; background-size: cover; }'; endif; if (!empty($header_css)) : wp_add_inline_style('avish-style', $header_css); endif; } // add_action( 'wp_enqueue_scripts', 'avish_custom_header' ); if (!function_exists('avish_post_ads_before')) : /** * Single post advertisement. * Before content. * * @since 1.0.0 */ function avish_post_ads_before($content) { // Set up empty variable $ads = ''; // Get the ads data set in customizer $img = avish_mod(PREFIX . 'post-ads-image-before'); $url = avish_mod(PREFIX . 'post-ads-url-before'); $custom = avish_mod(PREFIX . 'post-ads-custom-before'); // Set up our ads. if ($img || $url || $custom) { $ads = '
'; if ($custom) { $ads .= stripslashes($custom); } else { $ads .= ''; } $ads .= '
'; } // Display the ads before content if (!empty($ads) && is_single()) { $content = $ads . $content; } else { $content; } return $content; } endif; add_filter('the_content', 'avish_post_ads_before', 20); if (!function_exists('avish_post_ads_after')) : /** * Single post advertisement. * After content. * * @since 1.0.0 */ function avish_post_ads_after($content) { // Set up empty variable $ads = ''; // Get the ads data set in customizer $img = avish_mod(PREFIX . 'post-ads-image-after'); $url = avish_mod(PREFIX . 'post-ads-url-after'); $custom = avish_mod(PREFIX . 'post-ads-custom-after'); // Set up our ads. if ($img || $url || $custom) { $ads = '
'; if ($custom) { $ads .= stripslashes($custom); } else { $ads .= ''; } $ads .= '
'; } // Display the ads before content if (!empty($ads) && is_single()) { $content = $content . $ads; } else { $content; } return $content; } endif; add_filter('the_content', 'avish_post_ads_after', 20); if (!function_exists('avish_header_ads')) : /** * Prints the advertisement data set in customizer. * * @since 1.0.0 */ function avish_header_ads() { // Get the ads data set in customizer $img = avish_mod(PREFIX . 'header-ads-image'); $url = avish_mod(PREFIX . 'header-ads-url'); $custom = avish_mod(PREFIX . 'header-ads-custom'); // Display the data if ($img || $url || $custom) { echo '
'; if ($custom) { echo stripslashes($custom); } else { echo ''; } echo '
'; } } endif;