generate_after_do_template_part

generate_after_do_template_part

The generate_after_do_template_part hook appears at the end of generate_do_template_part() function.

This function is responsible for displaying the content on your page. In archives, it displays each post.

We can use this hook to display something after each post, or after a specific post. For example, this function will output text after the 4th post in your archives:

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';
}
} );

發表回覆

您的郵箱地址不會被公開。 必填項已用 * 標註