Archived topic
Adsense or banner below more tag
4 replies · Started by Mathias on February 15, 2017
How i can add a banner below the more tag in my first articel and it have only to show on my front/blog page and not if i open a artice. Now it after my first articel. i hope you can help me.
Here you see the banner under my article
How are you adding that ad currently?
Another user finds this plugin very helpful: https://en-ca.wordpress.org/plugins/ad-inserter/
I use a Bannerplugin and Added a php code in the archive.php
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
/* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
?>
------> <?php if (!$show_adsense) { ?>
<?php if(function_exists('drawAdsPlace')) drawAdsPlace(array('id' => 6), true); ?>
<?php $show_adsense = 1; } ?> <------
<?php endwhile; ?>
but i want this banner directly under the "more tag"
Editing core files is never good.
Instead, you could try using a filter:
add_filter( 'excerpt_more','tu_add_to_excerpt_more' );
function tu_add_to_excerpt_more( $more ) {
return $more . '<div class="your-ad">AD HTML</div>';
}