How to add Author to Qi WordPress Posts

Estimated read time 3 min read

Likely, you’re using the QI WordPress theme and finding it frustrating that you can’t add the author info right at the beginning of your blog. But worry no more – I have a practical solution for you.


How to add Author to QI WordPress Posts

If you are using the free version of the QI WordPress theme, then you will need to do the following:

Navigate to the correct folder

Change your folder to this directory wp-content/themes/qi/inc/blog/templates/parts/single.

wp-content/themes/qi/inc/blog/templates/parts/single

Make sure that post.php is there

Search for the post.php file in the directory. Is it there? perfect, lets continue.

post.php

Create a backup file

First create a copy of the original file, so you can easily fix mistakes (if any pop-up).

cp post.php post.php.bk

Open post.php

Open the post.php file in your favorite editor. Remove all of the code, and replace it with this code which includes the author into posts.

<article <?php post_class( 'qodef-blog-item qodef-e' ); ?>>
    <div class="qodef-e-inner">
        <?php
        // Include post media
        qi_template_part( 'blog', 'templates/parts/post-info/media' );
        ?>
        <div class="qodef-e-content">
            <div class="qodef-e-info qodef-info--top qodef-info-style">
                <?php
                if ( apply_filters( 'qi_filter_blog_show_date', true ) ) {
                    // Include post date info
                    qi_template_part( 'blog', 'templates/parts/post-info/date' );
                }

                if ( apply_filters( 'qi_filter_blog_show_category', true ) ) {
                    // Include post category info
                    qi_template_part( 'blog', 'templates/parts/post-info/category' );
                }

                // Include author and additional info
                ?>
                <div class="qodef-e-info-item qodef-e-info-author">
                    <a itemprop="author" class="qodef-e-info-author-link" href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>">
                        <span class="qodef-e-info-author-label"><?php esc_html_e( 'by', 'qi' ); ?></span>
                        <?php the_author_meta( 'display_name' ); ?>
                    </a>
                </div>
            </div>
            <div class="qodef-e-text">
                <?php
                // Include post title
                qi_template_part( 'blog', 'templates/parts/post-info/title' );

                // Include post content
                the_content();

                // Hook to include additional content after blog single content
                do_action( 'qi_action_after_blog_single_content' );
                ?>
            </div>
            <?php if ( get_the_tags() ) { ?>
            <div class="qdef-e-info qodef-info--bottom">
                <?php
                // Include post tags info
                qi_template_part( 'blog', 'templates/parts/post-info/tags' );
                ?>
            </div>
            <?php } ?>
        </div>
    </div>
</article>
The code which adds the author to the QI theme post page
The code which adds the author to the QI theme post page

Test it out

You should be done now. Navigate to any post on your website and double check the availability of the Author on top of the page. If any issues are present, it is wise to revert back to the original post.php file.


Congratulations, you have added the author field to your post.

Reza Rafati https://cyberwarzone.com

Reza Rafati, based in the Netherlands, is the founder of Cyberwarzone.com. An industry professional providing insightful commentary on infosec, cybercrime, cyberwar, and threat intelligence, Reza dedicates his work to bolster digital defenses and promote cyber awareness.

You May Also Like

More From Author