{"id":991,"date":"2019-11-21T04:00:54","date_gmt":"2019-11-21T04:00:54","guid":{"rendered":"http:\/\/www.projectimmerse.com\/blog\/?p=991"},"modified":"2020-06-15T07:16:23","modified_gmt":"2020-06-15T07:16:23","slug":"customizing-the-author-box-using-the-genesis-theme","status":"publish","type":"post","link":"https:\/\/www.projectimmerse.com\/blog\/customizing-the-author-box-using-the-genesis-theme\/","title":{"rendered":"Customizing the Author Box using the Genesis Theme"},"content":{"rendered":"<p>I had some consulting work come in &#8211; task was pretty straightforward, then again what<br \/>\nexactly is &#8220;straightfoward.&#8221; In software though, nothing is ever &#8220;straightforward&#8221;, though<br \/>\nthat word gets used a lot to describe something pretty close to being straightforward but not<br \/>\nexactly so.<\/p>\n<p>Alright anyway, I was working off a Genesis theme. Themes, templates, architecture. I think<br \/>\nthese terms are all synonymous, the keyword really here is architecture. There are some bad ones,<br \/>\ngood ones and terrible ones. Genesis in my opinion is pretty good. But what qualifies as &#8220;pretty good&#8221;, really? For starters I&#8217;d say architecture that is lightweight, modularized, and loosely coupled. Architecture where we can inject new features seamlessly.<\/p>\n<p>I was working on enabling an author box on a blog page, on every single blog post &#8211; so this was to be a global implementation for a blog. It&#8217;s been a while since I&#8217;ve worked with Genesis themes but good news is there&#8217;s a pretty big community around it and chances are I would be running into a frequent feature.<\/p>\n<p><!--more--><\/p>\n<p>The author box actually displays by default. Genesis hooks allow for moving the box in different locations of the template. Again, pretty &#8220;straightforward&#8221;. But not so. I was running into a conflict with another plugin, a related categories plugin that was taking up the same spot. So I had to figure out a way to sandwich this author box between the main content and that related posts area. So what I expected to take at least an hour to implement took roughly 3 hours. There was a lot of poking around to be had.<\/p>\n<h3>On to the codes&#8230;<\/h3>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\r\n\/* Customize Single Blog Post Author Box *\/\r\nremove_action( 'genesis_after_entry', 'genesis_do_author_box_single', 8 );\r\n\r\nadd_action( 'genesis_after_entry_content', 'wps_theme_author_box', 8 );\r\nfunction wps_theme_author_box() {\r\n\r\n  global $post;\r\n\r\n\tif ( is_singular('post') ) {\r\n    $author_id = $post-&gt;post_author;\r\n    $author_link    = get_author_posts_url( $author_id );\r\n\t\t$author_avatar \t= get_avatar( get_the_author_meta( 'ID' ), 70 );\r\n\t\t$author_name \t= get_the_author_meta( 'display_name' );\r\n\t\t$author_desc \t= get_the_author_meta( 'description' );\r\n\t\techo '&lt;section class=&quot;author-box&quot;&gt;';\r\n\t\techo $author_avatar;\r\n\t\techo '&lt;h4 class=&quot;author-box-title&quot;&gt;&lt;a href=&quot;' . esc_url( $author_link ) . '&quot; title=&quot;About '.$author_name.'&quot;&gt;About ' . $author_name . '&lt;\/a&gt;&lt;\/h4&gt;';\r\n\t\techo '&lt;div class=&quot;author-box-content&quot; itemprop=&quot;description&quot;&gt;&lt;p&gt;' . $author_desc . '&lt;\/p&gt;&lt;\/div&gt;';\r\n    echo '&lt;div class=&quot;clear&quot;&gt;&lt;\/div&gt;';\r\n    echo '&lt;\/section&gt;';\r\n\t}\r\n }\r\n\r\n \/* Display related posts plugin *\/\r\n add_action( 'genesis_entry_footer', 'manual_related_posts_plugin', 8 );\r\n function manual_related_posts_plugin() {\r\n   echo do_shortcode( '&#x5B;manual_related_posts]' );\r\n }\r\n\r\n<\/pre>\n<p>So I had to actually remove the related posts shortcode which was originally enabled by the plugin itself (in the settings area). So that was easy. There was only one optimal way of taking full control over this module &#8211; and I decided to use a combination of a Genesis hook and shortcode to accomplish this.<\/p>\n<p>The meat of the code though is the author box and there was some customization needed, a small one though. But a small request can be literally 10 lines of code in the software realm which was the case here. And so we pass a callback function to &#8216;<strong>genesis_after_entry_content<\/strong>&#8216; which allows us to hook into the markup and make any modifications needed. Notice though, we first remove the author box by hooking into &#8216;<strong>genesis_after_entry<\/strong>&#8216; while calling the <strong>remove_action<\/strong> function. We then add the feature back by calling <strong>add_action<\/strong>.<\/p>\n<p>From there it&#8217;s your usual PHP stuff and to ensure you are only implementing this on single blog posts we add a conditional <strong>if ( is_singular( &#8216;post&#8217; ) )<\/strong>. This all worked out really nice, I was able to take full control of what the author box should look like. Should there be any additional change requests, I can just go in there and make additional modifications.<\/p>\n<p>I hope this was useful for any Genesis theme newbies. We encourage you to keep immersing yourself into something new or if it&#8217;s an existing project, try learning it again &#8211; there might be something you missed along the way.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had some consulting work come in &#8211; task was pretty straightforward, then again what exactly is &#8220;straightfoward.&#8221; In software though, nothing is ever &#8220;straightforward&#8221;, though that word gets used a lot to describe something pretty close to being straightforward but not exactly so. Alright anyway, I was working off a Genesis theme. Themes, templates, &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.projectimmerse.com\/blog\/customizing-the-author-box-using-the-genesis-theme\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Customizing the Author Box using the Genesis Theme&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":1088,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-991","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Customizing the Author Box using the Genesis Theme - Project Immerse<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.projectimmerse.com\/blog\/customizing-the-author-box-using-the-genesis-theme\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Customizing the Author Box using the Genesis Theme - Project Immerse\" \/>\n<meta property=\"og:description\" content=\"I had some consulting work come in &#8211; task was pretty straightforward, then again what exactly is &#8220;straightfoward.&#8221; In software though, nothing is ever &#8220;straightforward&#8221;, though that word gets used a lot to describe something pretty close to being straightforward but not exactly so. Alright anyway, I was working off a Genesis theme. Themes, templates, &hellip; Continue reading &quot;Customizing the Author Box using the Genesis Theme&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.projectimmerse.com\/blog\/customizing-the-author-box-using-the-genesis-theme\/\" \/>\n<meta property=\"og:site_name\" content=\"Project Immerse\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-21T04:00:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-06-15T07:16:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2019\/11\/writing-permutations-using-python.png\" \/>\n\t<meta property=\"og:image:width\" content=\"750\" \/>\n\t<meta property=\"og:image:height\" content=\"532\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"projectimmerse\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"projectimmerse\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/customizing-the-author-box-using-the-genesis-theme\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/customizing-the-author-box-using-the-genesis-theme\\\/\"},\"author\":{\"name\":\"projectimmerse\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#\\\/schema\\\/person\\\/c53f2864be524ee6fa08a7e4800dd1e5\"},\"headline\":\"Customizing the Author Box using the Genesis Theme\",\"datePublished\":\"2019-11-21T04:00:54+00:00\",\"dateModified\":\"2020-06-15T07:16:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/customizing-the-author-box-using-the-genesis-theme\\\/\"},\"wordCount\":723,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/customizing-the-author-box-using-the-genesis-theme\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/writing-permutations-using-python.png\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/customizing-the-author-box-using-the-genesis-theme\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/customizing-the-author-box-using-the-genesis-theme\\\/\",\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/customizing-the-author-box-using-the-genesis-theme\\\/\",\"name\":\"Customizing the Author Box using the Genesis Theme - Project Immerse\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/customizing-the-author-box-using-the-genesis-theme\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/customizing-the-author-box-using-the-genesis-theme\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/writing-permutations-using-python.png\",\"datePublished\":\"2019-11-21T04:00:54+00:00\",\"dateModified\":\"2020-06-15T07:16:23+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#\\\/schema\\\/person\\\/c53f2864be524ee6fa08a7e4800dd1e5\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/customizing-the-author-box-using-the-genesis-theme\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/customizing-the-author-box-using-the-genesis-theme\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/customizing-the-author-box-using-the-genesis-theme\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/writing-permutations-using-python.png\",\"contentUrl\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/writing-permutations-using-python.png\",\"width\":750,\"height\":532,\"caption\":\"Permutations Using Python\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/customizing-the-author-box-using-the-genesis-theme\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Customizing the Author Box using the Genesis Theme\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/\",\"name\":\"Project Immerse\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#\\\/schema\\\/person\\\/c53f2864be524ee6fa08a7e4800dd1e5\",\"name\":\"projectimmerse\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g\",\"caption\":\"projectimmerse\"},\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/author\\\/projectimmerse\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Customizing the Author Box using the Genesis Theme - Project Immerse","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.projectimmerse.com\/blog\/customizing-the-author-box-using-the-genesis-theme\/","og_locale":"en_US","og_type":"article","og_title":"Customizing the Author Box using the Genesis Theme - Project Immerse","og_description":"I had some consulting work come in &#8211; task was pretty straightforward, then again what exactly is &#8220;straightfoward.&#8221; In software though, nothing is ever &#8220;straightforward&#8221;, though that word gets used a lot to describe something pretty close to being straightforward but not exactly so. Alright anyway, I was working off a Genesis theme. Themes, templates, &hellip; Continue reading \"Customizing the Author Box using the Genesis Theme\"","og_url":"https:\/\/www.projectimmerse.com\/blog\/customizing-the-author-box-using-the-genesis-theme\/","og_site_name":"Project Immerse","article_published_time":"2019-11-21T04:00:54+00:00","article_modified_time":"2020-06-15T07:16:23+00:00","og_image":[{"width":750,"height":532,"url":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2019\/11\/writing-permutations-using-python.png","type":"image\/png"}],"author":"projectimmerse","twitter_card":"summary_large_image","twitter_misc":{"Written by":"projectimmerse","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.projectimmerse.com\/blog\/customizing-the-author-box-using-the-genesis-theme\/#article","isPartOf":{"@id":"https:\/\/www.projectimmerse.com\/blog\/customizing-the-author-box-using-the-genesis-theme\/"},"author":{"name":"projectimmerse","@id":"https:\/\/www.projectimmerse.com\/blog\/#\/schema\/person\/c53f2864be524ee6fa08a7e4800dd1e5"},"headline":"Customizing the Author Box using the Genesis Theme","datePublished":"2019-11-21T04:00:54+00:00","dateModified":"2020-06-15T07:16:23+00:00","mainEntityOfPage":{"@id":"https:\/\/www.projectimmerse.com\/blog\/customizing-the-author-box-using-the-genesis-theme\/"},"wordCount":723,"commentCount":0,"image":{"@id":"https:\/\/www.projectimmerse.com\/blog\/customizing-the-author-box-using-the-genesis-theme\/#primaryimage"},"thumbnailUrl":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2019\/11\/writing-permutations-using-python.png","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.projectimmerse.com\/blog\/customizing-the-author-box-using-the-genesis-theme\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.projectimmerse.com\/blog\/customizing-the-author-box-using-the-genesis-theme\/","url":"https:\/\/www.projectimmerse.com\/blog\/customizing-the-author-box-using-the-genesis-theme\/","name":"Customizing the Author Box using the Genesis Theme - Project Immerse","isPartOf":{"@id":"https:\/\/www.projectimmerse.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.projectimmerse.com\/blog\/customizing-the-author-box-using-the-genesis-theme\/#primaryimage"},"image":{"@id":"https:\/\/www.projectimmerse.com\/blog\/customizing-the-author-box-using-the-genesis-theme\/#primaryimage"},"thumbnailUrl":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2019\/11\/writing-permutations-using-python.png","datePublished":"2019-11-21T04:00:54+00:00","dateModified":"2020-06-15T07:16:23+00:00","author":{"@id":"https:\/\/www.projectimmerse.com\/blog\/#\/schema\/person\/c53f2864be524ee6fa08a7e4800dd1e5"},"breadcrumb":{"@id":"https:\/\/www.projectimmerse.com\/blog\/customizing-the-author-box-using-the-genesis-theme\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.projectimmerse.com\/blog\/customizing-the-author-box-using-the-genesis-theme\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.projectimmerse.com\/blog\/customizing-the-author-box-using-the-genesis-theme\/#primaryimage","url":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2019\/11\/writing-permutations-using-python.png","contentUrl":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2019\/11\/writing-permutations-using-python.png","width":750,"height":532,"caption":"Permutations Using Python"},{"@type":"BreadcrumbList","@id":"https:\/\/www.projectimmerse.com\/blog\/customizing-the-author-box-using-the-genesis-theme\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.projectimmerse.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Customizing the Author Box using the Genesis Theme"}]},{"@type":"WebSite","@id":"https:\/\/www.projectimmerse.com\/blog\/#website","url":"https:\/\/www.projectimmerse.com\/blog\/","name":"Project Immerse","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.projectimmerse.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.projectimmerse.com\/blog\/#\/schema\/person\/c53f2864be524ee6fa08a7e4800dd1e5","name":"projectimmerse","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g","caption":"projectimmerse"},"url":"https:\/\/www.projectimmerse.com\/blog\/author\/projectimmerse\/"}]}},"_links":{"self":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts\/991","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/comments?post=991"}],"version-history":[{"count":3,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts\/991\/revisions"}],"predecessor-version":[{"id":995,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts\/991\/revisions\/995"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/media\/1088"}],"wp:attachment":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/media?parent=991"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/categories?post=991"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/tags?post=991"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}