Resize content inserted after paragraph post
-
Hello, I inserted this code to put adsense ad code, and it works well,
//Publicidad tras un párrafo concreto add_filter( 'the_content', 'publicidad_tras_parrafo' ); function publicidad_tras_parrafo( $content ) { if( !is_single() ) return $content; $paragraphAfter = 3; //Este es el número del párrafo tras el que irá la publicidad $content = explode ( "</p>", $content ); $new_content = ''; for ( $i = 0; $i < count ( $content ); $i ++ ) { if ( $i == $paragraphAfter ) { $new_content .= '<div style="width: 600px; height: 100px; padding: 5px 5px 5px 0; margin-right: 0;">'; $new_content .= 'adsense code'; $new_content .= '</div>'; } $new_content .= $content[$i] . "</p>"; } return $new_content; }
but I would put it adaptable to the size of the screen, that is not always stick with these features:
$new_content .= '<div style="width: 600px; height: 100px; padding: 5px 5px 5px 0; margin-right: 0;">';
What values should be given for the size of the content depending on the size of the screen? thanks
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Resize content inserted after paragraph post’ is closed to new replies.