You need to introduce your own hook (that’s how I’d do it).
I’ve added a custom hook in the following snippet:
<header class="entry-header alignwide">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
<?php do_action('custom_after_title_hook'); ?>
<?php twenty_twenty_one_post_thumbnail(); ?>
</header>
In order for this to work, you need to have:
- Access to the header.php
- OR overwrite it in a child-theme.
Last thing is easy: just call the function in your functions.php file like this:
<?php
function custom_after_title_hook(){
$some_var="<span>some text after title</span>";
return $some_var;
}
add_action('my_custom_action', 'custom_after_title_hook');
?>
You can also add this to a plugin, but then you need to work with ‘template_include’.