How to add content code in Middle of Post and create shortcode
Technology 0 CommentsHow to add content or text or any code in Middle of the wordpress Post and how to create short code in wordpress
1st tips and trick
This code add in function.php
add_filter(‘the_content’, ‘wpse_ad_content’);
function wpse_ad_content($content)
{
if (!is_single()) return $content;
$paragraphAfter = 2; // Enter number of paragraphs to display ad code and text after paragraphs .
$content = explode(“</p>”, $content); // paragraphs code
$new_content = ”;
for ($i = 0; $i < count($content); $i++) {
if ($i == $paragraphAfter) {
$new_content.= ‘<div style=”width: 260px; height: 260px; padding: 5px 6px 6px 0; float: left; margin-left: 0; margin-right: 14px;”>’;
$new_content.= ‘//Enter text code here and other content’;
$new_content.= ‘</div>’;
}
$new_content.= $content[$i] . “</p>”; // paragraphs code
}
return $new_content;
}
2nd tips and trick
Used the Quick Adsense Plugin in WordPress
https://wordpress.org/plugins/quick-adsense/screenshots/
Buy online Rajasthan gk book Railway JE CBT REET PAtwari Book SSC CGL Clerk GD Book Buy online Rajasthan gk book Railway JE CBT REET PAtwari Book SSC CGL Clerk GD Book