These hooks fire around a single article’s content — the post, page, or archive entry.
Hooks in firing order
generate_before_do_template_partgenerate_before_contentgenerate_after_entry_headergenerate_after_entry_contentgenerate_after_contentgenerate_after_do_template_part
Around the article
generate_before_do_template_part
GP Free
The generate_before_do_template_part hook appears at the start of generate_do_template_part() function.
Parameters: $template. Default: —.
add_action( 'generate_before_do_template_part', function( $template ) {
?>
<div class="my-notice">Insert your content here.</div>
<?php
} );
Related: generate_after_do_template_part Guide: Content
generate_before_content
GP Free
The generate_before_content hook appears inside the .inside-article element.
Parameters: none. Default: —.
add_action( 'generate_before_content', function() {
?>
<div class="my-notice">Insert your content here.</div>
<?php
} );
Related: generate_after_content Guide: Content
Inside the article
generate_after_entry_header
GP Free
The generate_after_entry_header hook appears after the .entry-header element.
Parameters: none. Default: —.
add_action( 'generate_after_entry_header', function() {
?>
<div class="my-notice">Insert your content here.</div>
<?php
} );
Guide: Content
generate_after_entry_content
GP Free
The generate_after_entry_content hook appears after the .entry-content element.
Parameters: none. Default: —.
add_action( 'generate_after_entry_content', function() {
?>
<div class="my-notice">Insert your content here.</div>
<?php
} );
Guide: Content
After the article
generate_after_content
GP Free
The generate_after_content hook appears before the closing .inside-article element.
Parameters: none. Default: —.
add_action( 'generate_after_content', function() {
?>
<div class="my-notice">Insert your content here.</div>
<?php
} );
Related: generate_before_content Guide: Content
generate_after_do_template_part
GP Free
The generate_after_do_template_part hook appears at the end of generate_do_template_part() function.
Parameters: $template. Default: —.
add_action( 'generate_after_do_template_part', function() {
global $wp_query;
if ( 3 === $wp_query->current_post ) {
echo 'Look at me after the fourth post';
}
} );
Related: generate_before_do_template_part Guide: Content