2019-01-09_095917

Some customers ask for the ability to add banners between chapter images. We do not want to add an option for that in the theme, but leave a way to hack that. It’s the hook ‘madara_after_chapter_image‘ that you can use. Here’s the guide.

Put this code your  child theme functions.php file

add_action(‘madara_after_chapter_image’, ‘my_madara_ads_between_images’, 10, 2);

function my_madara_ads_between_images($paged, $total_pages){

if($paged == 3){

?>

<img src=”https://yoursite.com/banner.ads”/>

<?php

}

}

The above code will show an image (as a banner) after the 3rd image in your chapter reading page. The ads could be anything, HTML code or Javascript code. I leave it to you.

If you want to display specific ads for specific manga, you can use this check to do it.

$chapter_slug = get_query_var( ‘chapter’ );

$manga_id = get_the_ID();

if($manga_id == 100 && $chapter_slug == ‘your-chapter-slug’){

// ads code here

}

The above code will check if current reading manga ID is 100, chapter slug is “your-chapter-slug”. So you can combine the whole things to make your own advertising system.

Hope this help!

SHARE THIS POST

Leave a Reply

Your email address will not be published. Required fields are marked *

*

seven + 11 =