build(); if ( ! empty( $css ) ) { echo "\n\n\n\n"; } } endif; add_action( 'wp_head', 'beginner_customizer_styles', 11 ); if ( ! function_exists( 'beginner_custom_feed_url' ) ) : /** * Custom RSS feed url. * * @since 1.0.0 */ function beginner_custom_feed_url( $output, $feed ) { // Get the custom rss feed url $url = beginner_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', 'beginner_custom_feed_url', 10, 2 ); /** * Display the custom header. * * @since 1.0.0 */ function beginner_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( 'beginner-style', $header_css ); endif; } add_action( 'wp_enqueue_scripts', 'beginner_custom_header' ); if ( ! function_exists( 'beginner_post_ads_before' ) ) : /** * Single post advertisement. * Before content. * * @since 1.0.0 */ function beginner_post_ads_before( $content ) { // Set up empty variable $ads = ''; // Get the ads data set in customizer $img = beginner_mod( PREFIX . 'post-ads-image-before' ); $url = beginner_mod( PREFIX . 'post-ads-url-before' ); $custom = beginner_mod( PREFIX . 'post-ads-custom-before' ); // Set up our ads. if ( $img || $url || $custom ) { $ads = '
'; } // Display the ads before content if ( ! empty( $ads ) && is_single() ) { $content = $ads . $content; } else { $content; } return $content; } endif; add_filter( 'the_content', 'beginner_post_ads_before', 20 ); if ( ! function_exists( 'beginner_post_ads_after' ) ) : /** * Single post advertisement. * After content. * * @since 1.0.0 */ function beginner_post_ads_after( $content ) { // Set up empty variable $ads = ''; // Get the ads data set in customizer $img = beginner_mod( PREFIX . 'post-ads-image-after' ); $url = beginner_mod( PREFIX . 'post-ads-url-after' ); $custom = beginner_mod( PREFIX . 'post-ads-custom-after' ); // Set up our ads. if ( $img || $url || $custom ) { $ads = ''; } // Display the ads before content if ( ! empty( $ads ) && is_single() ) { $content = $content . $ads; } else { $content; } return $content; } endif; add_filter( 'the_content', 'beginner_post_ads_after', 20 ); if ( ! function_exists( 'beginner_header_ads' ) ) : /** * Prints the advertisement data set in customizer. * * @since 1.0.0 */ function beginner_header_ads() { // Get the ads data set in customizer $img = beginner_mod( PREFIX . 'header-ads-image' ); $url = beginner_mod( PREFIX . 'header-ads-url' ); $custom = beginner_mod( PREFIX . 'header-ads-custom' ); // Display the data if ( $img || $url || $custom ) { echo ''; } } endif;