Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #461028

    I would like to set the layout of archive and category pages to match the layout of my blog page. Specifically, I’d like those pages to show an excerpt with a read more link and display the featured image in all cases (not video, audio, gallery, etc). That is, I’d like my blog page and my archives to use exactly the same layouts for each article. Is there a way to do this? See below for an example of the two pages looking substantially different.

    #461082

    Hey!

    Try adding this at the very end of your theme / child theme functions.php file:

    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');
    

    Cheers!
    Josue

    #461101

    Thanks. That’s very close! The only thing missing is the featured image. See the first private link I sent you above. How can I add the featured image in?

    Thanks!
    Kevin

    #461103

    Try adding this too:

    add_filter('avf_blog_style','avia_change_archive_blog_layout', 10, 2); 
    function avia_change_archive_blog_layout($layout, $context){
    	if(($context == 'archive') || ($context == 'tag')){
    		$layout = 'single-small';
    	}
    	return $layout;
    }

    Cheers!
    Josue

    #461121

    Jackpot!! Thanks so much for helping with this.

    #461126

    You are welcome, glad to help :)

    Regards,
    Josue

    #1059865

    Hey guys, how do I do this but maintain grid layout of blog?
    I tried changing ‘single-small’ to ‘blog-grid’ but that muted read more link this created…

    Thank you.

    #1060046

    Hi bulewold,

    Can you give us more context?
    Like you want blog use grid layout but on category or tag pages use this layout, etc.
    If you remove this part of the code:

    ($context == 'archive') ||

    it should not affect the blog page but it will also not affect archive pages.

    Best regards,
    Nikko

    #1062386

    Thanks for the help. So this is what we’re trying to do. We want ALL pages (blog page or categories, tags pages to have same grid look like this:
    new.i3fl.com/blog/
    where you get grid + read more link at the bottom.

    This is current category page:
    new.i3fl.com/category/chiropractic/

    I did remove context == archive you mentioned which fixed the view but it doesn’t have read more link.. how can I add read more link?

    Thank you!

    • This reply was modified 5 years, 10 months ago by bulewold.
    #1062780

    Hi bulewold,

    Try to copy archive.php from Enfold to your child theme then in line 52-60:

    $atts   = array(
        'type' => 'grid',
        'items' => get_option('posts_per_page'),
        'columns' => 3,
        'class' => 'avia-builder-el-no-sibling',
        'paginate' => 'yes',
        'use_main_query_pagination' => 'yes',
        'custom_query' => array( 'post__in'=>$post_ids, 'post_type'=>get_post_types() )
    );

    replace it with:

    $atts   = array(
        'type' => 'grid',
        'items' => get_option('posts_per_page'),
        'columns' => 3,
        'class' => 'avia-builder-el-no-sibling',
        'paginate' => 'yes',
        'use_main_query_pagination' => 'yes',
        'contents' 	=> 'excerpt_read_more',
        'custom_query' => array( 'post__in'=>$post_ids, 'post_type'=>get_post_types() )
    );

    Hope this helps.

    Best regards,
    Nikko

    #1070037

    Great, thank you so much!!! :D

    #1070177

    Hi bulewold,

    Glad that we could help you :)
    Thanks for using Enfold and have a great day!

    Best regards,
    Nikko

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Display excerpt and read more link on archive/category/type pages’ is closed to new replies.