Archived topic
How do I insert content into the theme without using a hook?
2 replies · Started by Kemo on March 10, 2019
Viewing posts 1–3 of 3
Hi!
I want to insert this:
<div class="meta-container">
<div class="meta-avatar">
<? echo get_avatar( get_the_author_meta('user_email'), $size = '150'); ?>
</div>
<div class="meta-info">
<div class="meta-author meta-text">
<em>written by</em>
<strong><?php the_author(); ?></strong>
</div>
<div class="meta-date meta-text">
<em>first posted on</em>
<strong><?php the_date(); ?></strong>
</div>
<div class="meta-modified meta-text">
<em>last updated on</em>
<strong><?php the_modified_date(); ?></strong>
</div>
</div>
</div>
in position: after_entry_title. specifically, I want to replace the regular post's meta. How can I do this in functions.php of my child theme, without using hooks? I don't like the hooks as they are more difficult to move between sites (i have several blogs.)
I figured it out. I disable the meta output in customizer and use something like this in functions.php:
add_action( 'generate_after_entry_title', 'better_meta' );
function better_meta(){
if ( is_singular() ) { ?>
html
<?php }
}
Hi there,
glad you found a solution.
This archived topic is closed to new replies.