Hi Gareth,
Try this PHP snippet instead:
function db_hook_inside_shortcode($atts, $content = null) {
ob_start();
do_action('db_inside_post_loop');
return ob_get_clean();
}
add_shortcode('hooky_shortcode', 'db_hook_inside_shortcode');
add_action('generate_after_do_template_part',function(){
global $loop_counter;
$loop_counter++;
if ( $loop_counter == 2 ) {
echo do_shortcode('[hooky_shortcode]');
}
});
With this, you’ll have a custom action hook called db_inside_post_loop after the 2nd Post in your Archives.
Then, you can use a Block or Hook Element to inject stuff in that specific location.
Just set the Hook name to Custom Hook – db_inside_post_loop.