{"id":227,"date":"2019-02-10T10:54:14","date_gmt":"2019-02-10T09:54:14","guid":{"rendered":"https:\/\/www.molongui.com\/help\/how-to-incorporate-molongui-authorship-template-tags-into-your-theme\/"},"modified":"2022-02-21T17:22:16","modified_gmt":"2022-02-21T16:22:16","slug":"how-to-incorporate-molongui-authorship-template-tags-into-your-theme","status":"publish","type":"post","link":"https:\/\/www.molongui.com\/help\/how-to-incorporate-molongui-authorship-template-tags-into-your-theme\/","title":{"rendered":"How To Incorporate Molongui Authorship Template Tags Into Your Theme"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"227\" class=\"elementor elementor-227\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-e3df188 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"e3df188\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-cdc7261\" data-id=\"cdc7261\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-88b9b96 elementor-widget elementor-widget-text-editor\" data-id=\"88b9b96\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Molongui Authorship makes it easy to assign one or more bylines to a post. Upon activation, you\u2019ll be able to start assigning multiple bylines right away. In order for those bylines to appear on the frontend, you may need to make some small modifications to your theme.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ec84098 elementor-widget elementor-widget-heading\" data-id=\"ec84098\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Available Template Tags<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9ca6a17 elementor-widget elementor-widget-text-editor\" data-id=\"9ca6a17\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>WordPress offers template tags like <code>the_author()<\/code> and <code>the_author_posts_link()<\/code> to display byline information associated with each post. You might see those inside files like <code>single.php<\/code> and <code>author.php<\/code>.<\/p>\n<p>Molongui Authorship has similar template tags for displaying multiple bylines. These are located in the <code>template-tags.php<\/code> file. The most relevant are:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-b9033aa elementor-section-stretched elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"b9033aa\" data-element_type=\"section\" data-settings=\"{&quot;stretch_section&quot;:&quot;section-stretched&quot;,&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-b64f799\" data-id=\"b64f799\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-a28b030 elementor-widget elementor-widget-code-highlight\" data-id=\"a28b030\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-php line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-php\">\n\t\t\t\t\t<xmp>\/**\n * Outputs the authors display names, without links to their archive pages.\n * This tag must be used within 'The Loop'.\n * This function is the one to use as replacement for 'the_author()' template tag.\n *\n * @param   int     $pid            Post id. Defaults to null.\n * @param   string  $separator      Delimiter that should appear between the authors.\n * @param   string  $last_separator Delimiter that should appear between the last two authors.\n * @param   string  $before         String to be prepended before the author name(s). Defaults to an empty string.\n * @param   string  $after          String to be appended after the author name(s). Defaults to an empty string.\n * @return  void                    Displays the byline.\n *\/\nfunction the_molongui_author( $pid = null, $separator = ', ', $last_separator = '', $before = '', $after = '' )\n{\n   echo get_the_molongui_author( $pid, $separator, $last_separator, $before, $after );\n}\n\n\/**\n * Outputs the authors display names, with links to their archive pages.\n * This tag must be used within 'The Loop'.\n * This function is the one to use as replacement for 'the_author_posts_link()' template tag.\n *\n * @param   int     $pid            Post id. Defaults to null.\n * @param   string  $separator      Delimiter that should appear between the authors.\n * @param   string  $last_separator Delimiter that should appear between the last two authors.\n * @param   string  $before         String to be prepended before the author name(s). Defaults to an empty string.\n * @param   string  $after          String to be appended after the author name(s). Defaults to an empty string.\n * @return  void                    Displays the byline with linked names.\n *\/\nfunction the_molongui_author_posts_link( $pid = null, $separator = ', ', $last_separator = '', $before = '', $after = '' )\n{\n   echo get_the_molongui_author_posts_link( $pid, $separator, $last_separator, $before, $after );\n}<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-06b2dc9 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"06b2dc9\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-84abc71\" data-id=\"84abc71\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-2f13257 elementor-widget elementor-widget-text-editor\" data-id=\"2f13257\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Each of these template tags will present different aspects of the multiple bylines. For instance, the first will display the first and last name of each author without any links. The second will display the first and last name of author linking back to their author profile page. And so on.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-36c5fe0 elementor-widget elementor-widget-heading\" data-id=\"36c5fe0\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Integrating Template Tags Into Your Theme<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-cb559ef elementor-widget elementor-widget-text-editor\" data-id=\"cb559ef\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>To integrate Molongui Authorship, you&#8217;ll want to replace existing author template tags in your theme with a simple conditional that uses the Molongui Authorship template tags if Molongui Authorship is available. The conditional prevents your site from breaking (e.g. white screen of death) if Molongui Authorship isn&#8217;t activated.<\/p>\n<p>For example, here&#8217;s how you would update <code>the_author_posts_link()<\/code> to instead use <code>the_molongui_author_posts_links()<\/code>:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-e4fb370 elementor-section-stretched elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"e4fb370\" data-element_type=\"section\" data-settings=\"{&quot;stretch_section&quot;:&quot;section-stretched&quot;,&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-76d947f\" data-id=\"76d947f\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-fe3870e elementor-widget elementor-widget-code-highlight\" data-id=\"fe3870e\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-php line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-php\">\n\t\t\t\t\t<xmp>\/**\n * MOLONGUI AUTHORSHIP\n * Using Molongui Authorship template tags.\n *\/\nif ( function_exists( 'the_molongui_author_posts_link' ) )\n{\n    the_molongui_author_posts_link();\n}\nelse\n{\n    the_author_posts_link();\n}<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-cb6aa06 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"cb6aa06\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-ee9ed76\" data-id=\"ee9ed76\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e94c842 elementor-widget elementor-widget-text-editor\" data-id=\"e94c842\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>However, the example above is a relatively simplistic way of presenting bylines. There\u2019s a good chance your theme will need an adaptation of it. Below we explain how to integrate Molongui Authorship template tags in some of the most used themes:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-afb447f elementor-widget elementor-widget-heading\" data-id=\"afb447f\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Twenty Seventeen<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-efa508b elementor-widget elementor-widget-text-editor\" data-id=\"efa508b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Here\u2019s how the change would look like for the WordPress&#8217; Twenty Seventeen theme:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-8475f5a elementor-section-stretched elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"8475f5a\" data-element_type=\"section\" data-settings=\"{&quot;stretch_section&quot;:&quot;section-stretched&quot;,&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-30b3c8c\" data-id=\"30b3c8c\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-7a9147a elementor-widget elementor-widget-code-highlight\" data-id=\"7a9147a\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-php line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-php\">\n\t\t\t\t\t<xmp>\/**\n * MOLONGUI AUTHORSHIP\n * Added support for Molongui Authorship template tags.\n *\/\nif ( ! function_exists( 'twentyseventeen_posted_on' ) )\n{\n    \/**\n     * Prints HTML with meta information for the current post-date\/time and author.\n     *\/\n    function twentyseventeen_posted_on()\n    {\n        if ( function_exists( 'get_the_molongui_author_posts_link' ) )\n        {\n            $byline = get_the_molongui_author_posts_link();\n        }\n        else\n        {\n            \/\/ Get the author name; wrap it in a link.\n            $byline = sprintf( _x( 'by %s', 'post author', 'twentyseventeen' ), '' . get_the_author() . '' );\n        }\n        \/\/ Finally, let's write all of this to the page.\n        echo '' . twentyseventeen_time_link() . ' ' . $byline . '';\n    }\n}<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-60bad5b elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"60bad5b\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-c4f7211\" data-id=\"c4f7211\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-7ffb4df elementor-widget elementor-widget-heading\" data-id=\"7ffb4df\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">GeneratePress<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3003059 elementor-widget elementor-widget-text-editor\" data-id=\"3003059\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>The GeneratePress theme provides the <code>generate_post_author_output<\/code> filter. So we can make us of that helpful filter to hook our template tag function.<\/p>\n\n<p>Try adding this piece of PHP code to your <code>functions.php<\/code> file within your child theme:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-e4ed248 elementor-section-stretched elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"e4ed248\" data-element_type=\"section\" data-settings=\"{&quot;stretch_section&quot;:&quot;section-stretched&quot;,&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-3d7f7ae\" data-id=\"3d7f7ae\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-916dacc elementor-widget elementor-widget-code-highlight\" data-id=\"916dacc\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-php line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-php\">\n\t\t\t\t\t<xmp>\/**\n * MOLONGUI AUTHORSHIP\n * Use theme's filter to customize byline with Molongui Authorship template tags.\n * @see 'inc\/structure\/post-meta.php' file\n *\/\nif ( function_exists( 'the_molongui_author_posts_link' ) )\n{\n   add_filter( 'generate_post_author_output', function()\n   {\n      the_molongui_author_posts_link();\n   });\n}<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Molongui Authorship makes it easy to assign one or more bylines to a post. Upon activation, you\u2019ll be able to start assigning multiple bylines right away. In order for those bylines to appear on the frontend, you may need to make some small modifications to your theme. Available Template Tags WordPress offers template tags like [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,1],"tags":[33,12],"class_list":["post-227","post","type-post","status-publish","format-standard","hentry","category-authorship","category-doc","tag-byline","tag-howto"],"_links":{"self":[{"href":"https:\/\/www.molongui.com\/help\/wp-json\/wp\/v2\/posts\/227","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.molongui.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.molongui.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.molongui.com\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.molongui.com\/help\/wp-json\/wp\/v2\/comments?post=227"}],"version-history":[{"count":10,"href":"https:\/\/www.molongui.com\/help\/wp-json\/wp\/v2\/posts\/227\/revisions"}],"predecessor-version":[{"id":1673,"href":"https:\/\/www.molongui.com\/help\/wp-json\/wp\/v2\/posts\/227\/revisions\/1673"}],"wp:attachment":[{"href":"https:\/\/www.molongui.com\/help\/wp-json\/wp\/v2\/media?parent=227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.molongui.com\/help\/wp-json\/wp\/v2\/categories?post=227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.molongui.com\/help\/wp-json\/wp\/v2\/tags?post=227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}