How to show the a custom taxonomy term on single post metadata

Question

I have a custom taxonomy called “Sources” (using Custom Post Type UI), where the sources are the names of publications where articles were originally published. Each post is an article, with a source selected. What I need to do is to show the source in the metadata under the post title. I’m using the Avada theme. Currently the title area of a post looks like this:

Article Title

By Author Name | Month, Year

What I want is this:

Article Title

Author Name, Source, Month, Year

Here’s an example post I’m working with in my dev environment:

http://dev.universaltheosophy.com/articles/the-logos-and-meditation/

I’d love to be able to do this with add_action in my child theme’s functions.php, and hook it before the date or after the author name. But I’m not sure how to do that.

All I see in the theme’s single post file file is:

<?php if ( 'below' === Avada()->settings->get( 'blog_post_title' ) ) : ?>
            <?php if ( 'below_title' === Avada()->settings->get( 'blog_post_meta_position' ) ) : ?>
                <div class="fusion-post-title-meta-wrap">
            <?php endif; ?>
            <?php $title_size = ( false === avada_is_page_title_bar_enabled( $post->ID ) ? '1' : '2' ); ?>
            <?php echo avada_render_post_title( $post->ID, false, '', $title_size ); // phpcs:ignore WordPress.Security.EscapeOutput ?>
            <?php if ( 'below_title' === Avada()->settings->get( 'blog_post_meta_position' ) ) : ?>
                <?php echo avada_render_post_metadata( 'single' ); // phpcs:ignore WordPress.Security.EscapeOutput ?>
                </div>
            <?php endif; ?>
        <?php endif; ?>

And I see in the theme’s files:

            // Render author meta data.
        if ( $settings['post_meta_author'] ) {
            ob_start();
            the_author_posts_link();
            $author_post_link = ob_get_clean();

            // Check if rich snippets are enabled.
            if ( fusion_library()->get_option( 'disable_date_rich_snippet_pages' ) && fusion_library()->get_option( 'disable_rich_snippet_author' ) ) {
                /* translators: The author. */
                $metadata .= sprintf( esc_html__( 'By %s', 'Avada' ), '<span class="vcard"><span class="fn">' . $author_post_link . '</span></span>' );
            } else {
                /* translators: The author. */
                $metadata .= sprintf( esc_html__( 'By %s', 'Avada' ), '<span>' . $author_post_link . '</span>' );
            }
            $metadata .= '<span class="fusion-inline-sep">|</span>';
        } else { // If author meta data won't be visible, render just the invisible author rich snippet.
            $author .= fusion_render_rich_snippets_for_pages( false, true, false );
        }

        // Render the updated meta data or at least the rich snippet if enabled.
        if ( $settings['post_meta_date'] ) {
            $metadata .= fusion_render_rich_snippets_for_pages( false, false, true );

            $formatted_date = get_the_time( fusion_library()->get_option( 'date_format' ) );
            $date_markup    = '<span>' . $formatted_date . '</span><span class="fusion-inline-sep">|</span>';
            $metadata      .= apply_filters( 'fusion_post_metadata_date', $date_markup, $formatted_date );
        } else {
            $date .= fusion_render_rich_snippets_for_pages( false, false, true );
        }

Other than this, I’m not sure what other info I need. Any help will be much appreciated! Keep in mind I’m very amateur at this.

0
, , Jon Fergus 3 years 2020-03-28T20:50:57-05:00 0 Answers 112 views 0

Leave an answer

Browse
Browse