Current File : /home/bravrvjk/cepurhuye.rw/wp-content/plugins/bopea-function/inc//single-content.php
<?php
defined( 'ABSPATH' ) || exit;
add_filter( 'the_content', 'jl_ads_inline1' );
add_filter( 'the_content', 'jl_ads_inline2' );
if ( ! function_exists( 'jl_ads_inline1' ) ) {
function jl_ads_inline1( $content ) {
$pos_ads = get_theme_mod( 'bopea_ads_sgin_p1', 2 );
$con_ads = get_theme_mod( 'bopea_ads_sgin_c1' );
if(empty($pos_ads)){
$pos_ads = 2;
}
if(!empty($con_ads)){
$con_ads = do_shortcode(wp_kses_post($con_ads));
if ( is_single() && ! is_admin() ) {
return jl_ads_inline1_after_p( $con_ads, $pos_ads, $content );
}
}
return $content;
}
}
if ( ! function_exists( 'jl_ads_inline1_after_p' ) ) {
function jl_ads_inline1_after_p( $insertion, $paragraph_id, $content ) {
$closing_p = '</p>';
$paragraphs = explode( $closing_p, $content );
foreach ($paragraphs as $index => $paragraph) {
if ( trim( $paragraph ) ) {
$paragraphs[$index] .= $closing_p;
}
if ( $paragraph_id == $index + 1 ) {
$paragraphs[$index] .= $insertion;
}
}
return implode( '', $paragraphs );
}
}
if ( ! function_exists( 'jl_ads_inline2' ) ) {
function jl_ads_inline2( $content ) {
$pos_ads = get_theme_mod( 'bopea_ads_sgin_p2', 2 );
$con_ads = get_theme_mod( 'bopea_ads_sgin_c2' );
if(empty($pos_ads)){
$pos_ads = 2;
}
if(!empty($con_ads)){
$con_ads = do_shortcode(wp_kses_post($con_ads));
if ( is_single() && ! is_admin() ) {
return jl_ads_inline2_after_p( $con_ads, $pos_ads, $content );
}
}
return $content;
}
}
if ( ! function_exists( 'jl_ads_inline2_after_p' ) ) {
function jl_ads_inline2_after_p( $insertion, $paragraph_id, $content ) {
$closing_p = '</p>';
$paragraphs = explode( $closing_p, $content );
foreach ($paragraphs as $index => $paragraph) {
if ( trim( $paragraph ) ) {
$paragraphs[$index] .= $closing_p;
}
if ( $paragraph_id == $index + 1 ) {
$paragraphs[$index] .= $insertion;
}
}
return implode( '', $paragraphs );
}
}