Community Forums › Forums › Archived Forums › General Discussion › How to display author name underneath pages
Tagged: author name on pages, Google Authorship
- This topic has 7 replies, 3 voices, and was last updated 10 years, 1 month ago by Genesis Developer.
-
AuthorPosts
-
April 1, 2014 at 3:37 pm #97973sillaMember
Hi,
I'm using the Lifestyle Pro theme with a static page as the homepage, and unfortunately pages don't display author names like posts do. I added the following code provided by genwrock here:
add_action( 'genesis_entry_header', 'genesis_page_info', 18 ); add_filter( 'genesis_page_info', 'do_shortcode', 20 ); function genesis_page_info() { global $post; if (is_page()): $post_info = apply_filters( 'genesis_page_info', '[post_date] ' . __( 'by', 'genesis' ) . ' [post_author_posts_link]' ); genesis_markup( array( 'html5' => sprintf( '<p class="entry-meta">%s</p>', $post_info ), 'xhtml' => sprintf( '<div class="post-info">%s</div>', $post_info ), ) ); endif; }
It worked, but it added the date and author name at the top of the page right underneath the title, and I would like it to be underneath the article. I would also prefer not to display the date at all.
Could someone please give me the code needed to accomplish this?
Thanks!
April 1, 2014 at 7:07 pm #97991Brad DaltonParticipantYou can filter the post info to remove the author link and then filter the post meta to add the author link http://wpsites.net/web-design/3-ways-to-move-post-meta-below-post-info/
April 3, 2014 at 10:58 am #98309sillaMemberHi Brad,
Thanks for your response. Maybe I'm doing something wrong (I don't know php, so I need exact instructions on what to copy where), but I can't get it to work. The solution on the page you linked to only seems to make the author name show up (below the title) on posts, not pages. And I already have them showing up below the posts thanks to the Genesis Simple Edits plugin, but unfortunately the plugin only seems to affect posts and not pages.
April 3, 2014 at 12:59 pm #98331Genesis DeveloperMemberadd_action( 'genesis_entry_footer', 'genesis_page_info', 18 ); add_filter( 'genesis_page_info', 'do_shortcode', 20 ); function genesis_page_info() { global $post; if (is_page()): $post_info = apply_filters( 'genesis_page_info', ' [post_author_posts_link]' ); genesis_markup( array( 'html5' => sprintf( '<p class="entry-meta">%s</p>', $post_info ), 'xhtml' => sprintf( '<div class="post-info">%s</div>', $post_info ), ) ); endif; }
Try this once
April 3, 2014 at 1:50 pm #98336sillaMemberThanks genwrock, it worked perfectly! 🙂 One more question - how can I add "By" in front of the author name? I tried copying that part from the first code you gave, but I did it wrong because it just gives me an error.
April 3, 2014 at 8:16 pm #98388Genesis DeveloperMemberTry this
$post_info = apply_filters( 'genesis_page_info', __( 'by', 'genesis' ) . ' [post_author_posts_link]' );
April 4, 2014 at 4:47 am #98421sillaMemberIt worked, thank you so much for your help! 🙂
April 4, 2014 at 4:48 am #98422Genesis DeveloperMemberYou are welcome.
-
AuthorPosts
- The topic ‘How to display author name underneath pages’ is closed to new replies.