The Genesis tutorials tells how to set up Author Boxes, how to style Author Boxes, and how to add Author Boxes to Author Archive Pages.
As it currently stands, the author box can only be added to the author archive pages and the single post pages. And from what I see, it doesn't appear on pages like http://domain.com/page-name but does appear on http://domain.com/category/post-name. However, what if I wanted to have the author box appear on all the pages or just some or not on some. Well, here's how to do it.
To insert the author box on ALL pages:
[php]/** Add Genesis Author Box on Single Pages**/
add_action('genesis_after_post', 'genesis_do_author_box_page');
function genesis_do_author_box_page() {
if ( !is_page() )
return;
if ( get_the_author_meta( 'genesis_author_box_single', get_the_author_meta('ID') ) ) {
genesis_author_box( 'single' );
}
}[/php]
To insert the author box on ALL pages except...
[php]/** Add Genesis Author Box on Single Pages**/
add_action('genesis_after_post', 'genesis_do_author_box_page');
function genesis_do_author_box_page() {
$page_exclusions = array(42,'about-me','Contact'); //edit these pages, can take slugs, page names, or page/post ID
if ( ( !is_page() ) || is_page($page_exclusions) )
return;
if ( get_the_author_meta( 'genesis_author_box_single', get_the_author_meta('ID') ) ) {
genesis_author_box( 'single' );
}
}[/php]
To insert the author box on only certain pages:
[php]/** Add Genesis Author Box on Single Pages**/
add_action('genesis_after_post', 'genesis_do_author_box_page');
function genesis_do_author_box_page() {
$page_inclusions = array(42,'about-me','Contact'); //edit these pages, can take slugs, page names, or page/post ID
if ( is_page($page_inclusions) ) {
if ( get_the_author_meta( 'genesis_author_box_single', get_the_author_meta('ID') ) ) {
genesis_author_box( 'single' );
}
}
else
return;
}[/php]
Vince says
There is really an easy way to do this, that is to go to your profile settings and enable it in every post.
Just a question though, what child them are you using?
Vince says
Ok, here’s the simple instruction:
1. Login to your Dashboard.
2. Go to “Users” Click “Your Profile”
3. Set the name you want to publicly appear.
4. Put something about yourself in “Biographical Info”. You can place some links if you want to.
5. Scroll down below and you will see “Genesis User Settings”. Below it, you will see Genesis Admin Menus and Author Box. Tick accordingly, especially the one with: Enable Author Box on this User’s Posts?
Things to note:
1. If you don’t see the Genesis options, you might have a plugin installed that hinders them to appear. Sometimes it is a plugin that is also about showing author boxes.
2. Another probable cause you might be using an older version of the theme that’s why there are lots of code conflicts and both the child theme and the Genesis framework cannot connect with each other. In that case, you will need to install the latest version of the new framework and the new child theme. Or you will have to install it manually.
3. To have a gravatar enabled, I think you need to open an account on Gravatar.com which is also free. All you have to do is open an account and upload your picture.
Travis Smith says
Thanks Vince! However, this post gives instuctions and code that goes beyond those tick marks to allow the Author Box to be shown on pages, not just posts or Archives.
Vince says
Yep… and that’s the beauty of Genesis customization. It’s a little bit technical, but very rewarding after you get what you really want. 🙂
But as for me, the default author box feature is already enough to me, simply because, normally I only put author info on the posts, and not on the pages because most of my website pages already talk about me and my business.
Vince says
By the way Travis, I noticed in your About Me page, you are a Theologian and a PHP?Java Script Coder Geek. 🙂 It’s really nice to know people like you having the same interest. It’s really nice to be here in your site. I am also a church minister, and had, Master of Divinity (“at least that’s what the piece of paper say”. Lol!). I am not a coder though. But I am a web savvy who also owned several websites.
Perhaps one of these days, we can collaborate in some online jobs, ventures, or something. If God permits. 🙂
Blessings!!!
Jack Falconberg says
Travis, thanks for the informative post. Where would this code be inserted? functions.php? In the page content itself? Forgive me if this seems elementary (I’m not proficient). Thanks.
wpsmith says
Hello Jack,
This would go into functions.php. Depending on which code you use the $page_exclusions or $page_inclusions will determine which pages the authorbox appears.
Thanks,
Stefan says
Hey,
Is it possible to set the author box to be active by default for all newly registered users?
Thanks for any help.
Jennifer Johnson says
Thank you! I have been trying for hours! Your code worked perfectly! Thank you so much! I have hundreds of posts…but also quite a few pages and it bothered me that they were not showing my authorship.
Kingsley says
Mine is not showing.. please can i have the previous code you used in this post?? this code is different from the code i used before
Sam says
** Add Genesis Author Box on Single Pages**/ doesnt work with Genesis 2.0.
Are there new hooks to make this function work?