_shortcode( $ampbanner ) . '' . $textafter; } elseif ( 'sticky' === $positionamp ) { $ad_code = $textbefore . '
' . $textafter; } else { $ad_code = $textbefore . ' ' . $textafter; } if ( is_singular( array( 'post' ) ) && in_the_loop() ) { return wpmedia_helper_after_paragraph( $ad_code, 2, $content ); } } } else { if ( isset( $banner ) && ! empty( $banner ) ) { if ( 'right' === $position ) { $class = ' text-right'; } elseif ( 'center' === $position ) { $class = ' text-center'; } elseif ( 'parallax' === $position ) { $class = ' gmr-parallax'; } elseif ( 'sticky' === $position ) { $class = ' gmr-parallax pos-stickywrap'; } else { $class = ''; } if ( 'parallax' === $position ) { $ad_code = $textbefore . ' ' . $textafter; } elseif ( 'sticky' === $position ) { $ad_code = $textbefore . ' ' . $textafter; } else { $ad_code = $textbefore . ' ' . $textafter; } if ( is_singular( array( 'post' ) ) && in_the_loop() ) { return wpmedia_helper_after_paragraph( $ad_code, 2, $content ); } } } } return $content; } endif; add_filter( 'the_content', 'wpmedia_add_banner_inside_content' ); if ( ! function_exists( 'wpmedia_banner_after_content' ) ) { /** * Adding banner at before content via hook * * @since 1.0.0 * @return string */ function wpmedia_banner_after_content() { $ampbanner = get_theme_mod( 'gmr_adsaftercontent_amp' ); $banner = get_theme_mod( 'gmr_adsaftercontent' ); $position = get_theme_mod( 'gmr_adsaftercontentposition' ); $ads = ''; if ( wpmedia_is_amp() ) { if ( isset( $ampbanner ) && ! empty( $ampbanner ) ) { $ads .= ' '; } } else { if ( isset( $banner ) && ! empty( $banner ) ) { if ( 'right' === $position ) { $class = ' text-right'; } elseif ( 'center' === $position ) { $class = ' text-center'; } else { $class = ''; } $ads .= ' '; } } return $ads; } } if ( ! function_exists( 'wpmedia_add_banner_after_content' ) ) : /** * Insert content after box content single * * @since 1.0.0 * @param string $content Content Posts. * @return string */ function wpmedia_add_banner_after_content( $content ) { if ( is_singular( array( 'post' ) ) && in_the_loop() ) { $content = $content . wpmedia_banner_after_content(); } return $content; } endif; /* endif wpmedia_add_banner_after_content */ add_filter( 'the_content', 'wpmedia_add_banner_after_content', 30 ); if ( ! function_exists( 'wpmedia_banner_stickyright_content' ) ) { /** * Adding banner at before content via hook * * @since 1.0.0 * @return void */ function wpmedia_banner_stickyright_content() { $banner = get_theme_mod( 'gmr_adsstickyrightcontent' ); if ( ! wpmedia_is_amp() ) { if ( isset( $banner ) && ! empty( $banner ) ) { echo ' '; } } } } add_action( 'wpmedia_banner_stickyright_content', 'wpmedia_banner_stickyright_content', 10 ); if ( ! function_exists( 'wpmedia_banner_after_relpost' ) ) { /** * Adding banner after related posts via hook * * @since 1.0.0 * @return void */ function wpmedia_banner_after_relpost() { $ampbanner = get_theme_mod( 'gmr_adsafterrelpost_amp' ); $banner = get_theme_mod( 'gmr_adsafterrelpost' ); $position = get_theme_mod( 'gmr_adsafterrelpostposition' ); if ( wpmedia_is_amp() ) { if ( isset( $ampbanner ) && ! empty( $ampbanner ) ) { echo ' '; } } else { if ( isset( $banner ) && ! empty( $banner ) ) { if ( 'right' === $position ) { $class = ' text-right'; } elseif ( 'center' === $position ) { $class = ' text-center'; } else { $class = ''; } echo ' '; } } } } add_action( 'wpmedia_banner_after_relpost', 'wpmedia_banner_after_relpost', 10 ); if ( ! function_exists( 'wpmedia_floating_banner_left' ) ) { /** * Adding banner at top via hook * * @since 1.0.0 * @return void */ function wpmedia_floating_banner_left() { $banner = get_theme_mod( 'gmr_adsfloatleft' ); if ( ! wpmedia_is_amp() ) { if ( isset( $banner ) && ! empty( $banner ) ) { echo ' '; } } } } add_action( 'wpmedia_floating_banner_left', 'wpmedia_floating_banner_left', 10 ); if ( ! function_exists( 'wpmedia_floating_banner_right' ) ) { /** * Adding banner at top via hook * * @since 1.0.0 * @return void */ function wpmedia_floating_banner_right() { $banner = get_theme_mod( 'gmr_adsfloatright' ); if ( ! wpmedia_is_amp() ) { if ( isset( $banner ) && ! empty( $banner ) ) { echo ' '; } } } } add_action( 'wpmedia_floating_banner_right', 'wpmedia_floating_banner_right', 10 ); if ( ! function_exists( 'wpmedia_floating_banner_footer' ) ) { /** * Adding floating banner * * @since 1.0.0 * @return void */ function wpmedia_floating_banner_footer() { $banner = get_theme_mod( 'gmr_adsfloatbottom' ); if ( ! wpmedia_is_amp() ) { if ( isset( $banner ) && ! empty( $banner ) ) { echo ' '; } } } } add_action( 'wpmedia_floating_banner_footer', 'wpmedia_floating_banner_footer', 20 ); if ( ! function_exists( 'wpmedia_footerbanner' ) ) { /** * Adding banner at top via hook * * @since 1.0.0 * @return void */ function wpmedia_footerbanner() { $ampbanner = get_theme_mod( 'gmr_adsfooter_amp' ); $banner = get_theme_mod( 'gmr_adsfooter' ); if ( wpmedia_is_amp() ) { if ( isset( $ampbanner ) && ! empty( $ampbanner ) ) { echo ' '; } } else { if ( isset( $banner ) && ! empty( $banner ) ) { echo ' '; } } } } add_action( 'wpmedia_footerbanner', 'wpmedia_footerbanner', 10 ); if ( ! function_exists( 'wpmedia_popup_banner' ) ) { /** * Adding popup banner * * @since 1.0.5 * @return void */ function wpmedia_popup_banner() { $banner = get_theme_mod( 'gmr_adspopup' ); if ( ! wpmedia_is_amp() ) { if ( isset( $banner ) && ! empty( $banner ) ) { echo '