I have the following structure:
add_action('my_content', 'standard_loop');
function standard_loop() {
if (have_posts()) :
while (have_posts()) :
the_post();
do_action('loop_entry_before');
do_action('loop_entry');
do_action('loop_entry_after');
endwhile;
endif;
}
add_action('loop_entry_before', 'do_entry', 1);
function do_entry() {
if ( get_the_title() ) {
add_action('loop_entry_before', 'function_that_adds_h2_structure');
}
add_action('loop_entry_entry', 'function_that_adds_content_structure');
}
The issue is that all post display the function_that_adds_h2_structure even if is only empty html and the post has no title. This is just an example for using login in the do_entry();
Thanks