- This topic has 7 replies, 3 voices, and was last updated 3 years, 5 months ago by David.
-
AuthorPosts
-
October 22, 2020 at 10:48 pm #1500722Aleksey
Hi!
I’ve editied post-meta.php here “generatepress\inc\structure” to add author box inside <footer> tag. To save this edit from deleting during further updates I’ve created the same folders in the child theme and copied my new post-meta.php there. But unfortunately, edits don’t show on the website.
How can I make this changes work with child theme?
October 22, 2020 at 11:20 pm #1500733ElvinStaffCustomer SupportHi,
I believe this can be done w/ just filters and hooks instead of creating a post-meta.php.
Something like this:
add_filter('generate_before_footer_content', function(){ //your author box code here });
Simply add this code to your child theme’s functions.php.
If you want to place it somewhere else, you can replace the hook w/ any hooks found here:
https://docs.generatepress.com/article/hooks-visual-guide/October 23, 2020 at 1:17 am #1500850AlekseyThanks for a quick reply. Somehow this code:
add_filter('generate_after_entry_content', function() { <strong><div class="author-box"></strong> <?php global $post; ?> <div class="avatar"><?php echo get_avatar ( get_the_author_meta( 'ID' )); ?></div> <div class="author-title" itemprop="author" itemscope itemtype="http://schema.org/Person"> <span itemprop="name"><?php printf( get_the_author_meta( 'display_name') );?></span> </div> <div class="author-summary"> <p class="author-description"><?php echo nl2br( get_the_author_meta( 'description' ), null ); ?></p> </div> </div> });
doesn’t want to work.
syntax error, unexpected ‘<‘
for bolded line.
October 23, 2020 at 3:57 am #1501004DavidStaffCustomer SupportHi there,
you would need to use a Action Hook like so:
add_action('generate_after_entry_content', function() { ?> // Your HTML Goes here <?php });
Or the simpler process is to just add your HTML to the a Hook Element:
https://docs.generatepress.com/article/hooks-element-overview/
October 23, 2020 at 4:41 am #1501063AlekseyThanks David, now my html works, but it puts author box outside <footer> tag: http://prntscr.com/v59gsv
How can I place it inside <footer>?
October 23, 2020 at 5:25 am #1501101DavidStaffCustomer SupportThere isn’t a hook inside there. Instead you would first need to unhook the footer meta:
add_action( 'wp', function() { remove_action( 'generate_after_entry_content', 'generate_footer_meta' ); } );
Then Hook back it back in with your own content:
add_action('generate_after_entry_content', function() { ?> <footer class="entry-meta"> // Your HTML Goes here <?php generate_entry_meta(); ?> </footer> <?php });
October 23, 2020 at 5:51 am #1501136AlekseyBrilliant! Working like a charm 🙂
Thank you for your help!
October 23, 2020 at 6:02 am #1501144DavidStaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.