Carl Middleton
asked 6 years ago

I would like author and guest author names and biographical information to be included in search results. They are not being returned on our site at this time. 
Forgive me if I am missing something simple, I checked the documentation and searched previous questions.
Thank you.

Carl Middleton
replied 6 years ago

Are tags also not included in search results? Is this intentional?

3 Answers
DominicStaff
answered 6 years ago

Technically, the info has been hidden from the search results page. However, if you want to have, you can take a look at the instruction below:
– To display the author information & Tags, you can do as the following:
1. Open the content-search.php file. Add the following code to the line 28.

  <footer class="entry-meta entry-meta-bottom">
                <?php
                    /* translators: used between list items, there is a space after the comma */
                    $tags_list = get_the_tag_list( '', __( ', ', 'dw_focus' ) );
                    if ( $tags_list ) :
                ?>
                <span class="tags-links">
                    <?php printf( __( 'Tags: %1$s', 'dw_focus' ), $tags_list ); ?>
                </span>
                <?php endif; // End if $tags_list ?>

</footer>

Add the following code under line 31.

<div class="entry-author">
            <div class="author-info">
                <div class="author-avatar">
                <?php  
                    if ( function_exists( 'coauthors_posts_links' ) && get_the_post_thumbnail( get_the_author_meta( 'ID', $author ) ) ) {
                        echo get_the_post_thumbnail( get_the_author_meta( 'ID', $author ), array(90,90) );
                    } else {
                        echo get_avatar( $author, 90 );
                    }
                ?>
                </div><!-- .author-avatar -->
                <div class="author-description">
                    <h2><a href="<?php echo esc_url( get_author_posts_url( $author ) ); ?>" rel="author"><?php echo get_the_author_meta( 'display_name', $author ); ?></a></h2>

<p class=”description”><?php the_author_meta( ‘description’, $author ); ?></p>

<?php if ( function_exists( ‘coauthors_posts_links’ ) && get_the_author_meta( ‘website’, $author ) ) : ?>
<p class=”user-url”>
<span><?php _e(‘Website URL:’,’dw_focus’) ?></span>
<a href=”<?php the_author_meta( ‘website’, $author ); ?>” title=”<?php the_author_meta( ‘website’, $author ); ?>”>
<?php the_author_meta( ‘website’, $author ); ?>
</a>
</p>
<?php elseif ( get_the_author_meta( ‘user_url’, $author ) ) : ?>
<p class=”user-url”>
<span><?php _e(‘Website URL:’,’dw_focus’) ?></span>
<a href=”<?php the_author_meta( ‘user_url’, $author ); ?>” title=”<?php the_author_meta( ‘user_url’, $author ); ?>”>
<?php the_author_meta( ‘user_url’, $author ); ?>
</a>
</p>
<?php endif; ?>

<?php if ( get_the_author_meta( ‘aim’, $author ) ) : ?>
<p class=”aim”>
<span><?php _e(‘AIM:’,’dw_focus’) ?></span>
<a href=”aim:goaim?screenname=<?php the_author_meta( ‘aim’, $author ); ?>” title=”<?php the_author_meta( ‘aim’, $author ); ?>”><?php the_author_meta( ‘aim’, $author ); ?></a>
</p>
<?php endif; ?>

<?php if ( function_exists( ‘coauthors_posts_links’ ) && get_the_author_meta( ‘yahooim’, $author ) ) : ?>

<p class=”yahoo”>
<span><?php _e(‘Yahoo:’,’dw_focus’) ?></span>
<a href=”ymsgr:sendim?<?php the_author_meta( ‘yahooim’, $author ); ?>” title=”<?php the_author_meta( ‘yahooim’, $author ); ?>”><?php the_author_meta( ‘yahooim’, $author ); ?></a>
</p>
<?php elseif ( get_the_author_meta( ‘yim’, $author ) ) : ?>
<p class=”yahoo”>
<span><?php _e(‘Yahoo:’,’dw_focus’) ?></span>
<a href=”ymsgr:sendim?<?php the_author_meta( ‘yim’, $author ); ?>” title=”<?php the_author_meta( ‘yim’, $author ); ?>”><?php the_author_meta( ‘yim’, $author ); ?></a>
</p>
<?php endif; ?>
</div><!– .author-description –>
</div><!– .author-info –>
</div><!– .entry-author –>

2. Please follow the jetpack’s guideline in the Blog article on how to use Edit CSS here. http://designwall.com/blog/using-jetpack-custom-css-for-your-wordpress-site/
After that, just add the following code to the Edit Css.

.search-results .author-avatar {
    float: left;
    width: 6%;
}
.search-results .author-description h2 {
    font-size: 14px;
    line-height: 10px;
}
.search-results .entry-author {
    border: 1px solid #DDDDDD;
    padding: 13px;
}
.search-results .author-description {
    margin-left: 50px;
}
@media (max-width: 480px){
  .search .content-inner .has-thumbnail .post-inner {
      margin-left: 3px;
  }
  .search .content-inner .entry-title {
    margin-left: 130px;
  }
  .search-results .author-avatar {
    float: left;
    width: 16%;
}
.search .content-inner .entry-thumbnail {
    margin-right: 20px;
}
}

Save it and see how that goes ! Let us know if there is anything else 🙂 Hope this helps !

Carl Middleton
answered 6 years ago

Thanks Dominic, I have installed Jetpack, and we may or may not make this change. We are trying to avoid customization whenever possible, to keep things simple.

DominicStaff
answered 6 years ago

If you still face there issue, please let me know. We will help you resolve it.

Powered by DW Question & Answer Pro