Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #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

    #939739

    Hey 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,
    Victoria

    #940009
    This reply has been marked as private.
    #940758

    Hi 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-23573

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #941042
    This reply has been marked as private.
    #942085

    Hi,

    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,
    Basilis

    #942105

    hi,

    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>’;

    #942142

    Hi,

    Great, glad you got it working and thanks for sharing. Much appreciated :-)

    Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.