-
AuthorPosts
-
April 10, 2018 at 12:24 am #939468
Hi,
I’m using the following snippet to show excerpts on category archive pages:
// show excerpt on blog archive pages
function change_blog_archive_style() {
global $avia_config;
if(!is_single()){ $avia_config[‘blog_content’] = “excerpt_read_more”; }
}
add_action(‘get_header’, ‘change_blog_archive_style’);Is there a way to get this to also work on the author pages as well (the page archive for a single author that links from the author’s name under post titles)?
thanks
April 10, 2018 at 10:17 am #939739Hey josiehaney,
Here is the code you can put in your functions.php, we modified it a bit to work for the author as well
function change_blog_archive_style() { global $avia_config; if (is_single() && is_author()) { $avia_config['blog_content'] = "excerpt_read_more"; } else if(!is_single()){ $avia_config['blog_content'] = "excerpt_read_more"; } } add_action('get_header', 'change_blog_archive_style');
If you need further assistance please let us know.
Best regards,
VictoriaApril 10, 2018 at 8:45 pm #940009This reply has been marked as private.April 12, 2018 at 5:03 am #940758Hi josiehaney,
Well, if this is not working there, you might want to consider building a custom template for authors.
https://code.tutsplus.com/articles/how-to-create-a-wordpress-authors-page-template–wp-23573If you need further assistance please let us know.
Best regards,
VictoriaApril 12, 2018 at 5:03 pm #941042This reply has been marked as private.April 14, 2018 at 11:53 pm #942085Hi,
Unfortunately, it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)
Best regards,
BasilisApril 15, 2018 at 12:33 am #942105hi,
this wound up being pretty easy, here’s what I did:
1) in my child theme I created an includes folder and copied loop-author.php from the parent theme and place it in the folder I created in the child theme
2) I added a couple of lines to $content_output around line 69:
$content_output = ‘<div class=”entry-content” ‘.avia_markup_helper(array(‘context’ => ‘entry_content’,’echo’=>false)).’>’;
$content_output .= get_the_post_thumbnail( $post_id, ‘blog-featured-image’);
$content_output .= wpautop($content);
$content_output .= ‘<div class=”read-more-link”> class=”more-link””>Read more<span class=”more-link-arrow”></span></div>’;
$content_output .= ‘</div>’;3) this line add a custom image that I added to the functions.php file entitle “blog-featured-image”:
$content_output .= get_the_post_thumbnail( $post_id, ‘blog-featured-image’);4) added this line to link to the post above the closing div tag:
$content_output .= ‘<div class=”read-more-link”> class=”more-link””>Read more<span class=”more-link-arrow”></span></div>’;April 15, 2018 at 7:25 am #942142 -
AuthorPosts
- You must be logged in to reply to this topic.