Using actions and filters
Manga provides some hooks allowing developers to customize the theme (using child-theme or plugin)
For more details of using hooks (action and filter) you can refer to these documents:
- https://codex.wordpress.org/Plugin_API
- https://developer.wordpress.org/reference/functions/add_filter/
1. Manga before chapter listing: allow user do action right before chapters are listed in a manga
do_action ('madara_before_chapter_listing');
2.Manga after chapter listing: allow user do action right after chapters are listed in a manga
do_action('madara_after_chapter_listing');
In this example, we will introduce you how to use Manga before chapter listing action:
- In the function.php of Mandara Child theme
add_action( 'madara_after_chapter_listing', 'madara_after_chapter_listing' ); function madara_after_chapter_listing() { /* * your code here * */ }
Screenshot Example:
Code
Result
3. Manga before & after Text Chapter content: allow user do action right after Text Chapters in Manga Reading.
do_action('madara_before_text_chapter_content');
do_action('madara_after_text_chapter_content');
Similar to the example above, you can use it to customize the theme (using child-theme or plugin).
4. Manga before & after Video Chapters content: allow user do action right after Video Chapters in Manga Reading.
do_action('madara_before_video_chapter_content');
do_action('madara_after_video_chapter_content');
Similar to the example above, you can use it to customize the theme (using child-theme or plugin).
5. Manga before & after Manga Discussion : allow user do action right before and after Manga Discussion.
do_action('madara_before_manga_discussion');
do_action('madara_after_manga_discussion');
Similar to the example above, you can use it to customize the theme (using child-theme or plugin).
6. Manga before & after Chapter Images: allow user do action right before and after every image in reading page.
do_action('madara_before_chapter_image', $index, $total_item);
do_action('madara_after_chapter_image', $index, $total_item);
Similar to the example above, you can use it to customize the theme (using child-theme or plugin).
$index
parameter will be the index of that image on reading page.
$total_item
return total of image per page on reading page.
7. Manga before wrap HTML Tag & after wrap HTML Tag Chapter Images (for reading List style): allow user do action right before and after every HTML Tag of image in reading page.
do_action('madara_before_chapter_image_wrapper', $index, $total_item);
do_action('madara_after_chapter_image_wrapper', $index, $total_item);
Similar to the example above, you can use it to customize the theme (using child-theme or plugin).
$index
parameter will be the index of that image on reading page.
$total_item
return total of image per page on reading page.
8. Manga Advertising Filter: allow user filter advertising content.
apply_filters( 'madara_ads_footer', $ads_content );
: Footer Advertising
apply_filters( 'madara_ads_wall_left', $ads_content );
Wall left Advertising
apply_filters( 'madara_ads_wall_right', $ads_content );
Wall right Advertising
apply_filters( 'madara_ads_before_content', $ads_content );
Before content Advertising
apply_filters( 'madara_ads_after_content', $ads_content );
After content Advertising