Home › Forums › Support › Adding author to pages This topic has 7 replies, 2 voices, and was last updated 6 years, 1 month ago by Tom. Viewing 8 posts - 1 through 8 (of 8 total) Author Posts February 27, 2018 at 7:28 am #506994 gedosan Hi – was wondering if there’s a way to add the author byline to pages rather than just posts? I tried adding {{post_author}} as a GP hook but it didn’t work. Just want it to appear below the page title. Thanks G February 27, 2018 at 8:39 pm #507493 TomLead Developer Lead Developer Hi there, Give this function a shot: add_action( 'generate_after_entry_header', 'tu_page_meta' ); function tu_page_meta() { if ( 'page' == get_post_type() ) : ?> <div class="entry-meta"> <?php generate_posted_on(); ?> </div><!-- .entry-meta --> <?php endif; } Let me know π February 28, 2018 at 12:15 am #507589 gedosan Cheers. Added it as a GP hook but didn’t work. So tried it as a snippet, still no joy. Am i doing something wrong?! Cheers February 28, 2018 at 10:13 am #508124 TomLead Developer Lead Developer Snippet is the right way to do it. I just tweaked the code above so it should work now π February 28, 2018 at 2:15 pm #508357 gedosan Cheers, it’s cool (and working) but it’s appearing on some page (e.g. the homepage) where I don’t want it to. Is there an easy way to exclude certain pages? Thanks February 28, 2018 at 11:12 pm #508550 TomLead Developer Lead Developer You could do this: add_action( 'generate_after_entry_header', 'tu_page_meta' ); function tu_page_meta() { if ( 'page' == get_post_type() && ! is_page( array( 10, 15, 20 ) ) ) : ?> <div class="entry-meta"> <?php generate_posted_on(); ?> </div><!-- .entry-meta --> <?php endif; } 10, 15 and 20 being the IDs of the pages you want to exclude. March 1, 2018 at 12:33 pm #509140 gedosan Works a treat – the best support again, awesome thanks. March 1, 2018 at 8:55 pm #509372 TomLead Developer Lead Developer You’re welcome π Author Posts Viewing 8 posts - 1 through 8 (of 8 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In