-
AuthorPosts
-
June 18, 2015 at 2:54 am #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.
June 18, 2015 at 5:41 am #461082Hey!
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!
JosueJune 18, 2015 at 6:26 am #461101Thanks. 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!
KevinJune 18, 2015 at 6:34 am #461103Try 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!
JosueJune 18, 2015 at 7:02 am #461121Jackpot!! Thanks so much for helping with this.
June 18, 2015 at 7:18 am #461126You are welcome, glad to help :)
Regards,
JosueJanuary 29, 2019 at 2:45 am #1059865Hey 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.
January 29, 2019 at 3:31 pm #1060046Hi 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,
NikkoFebruary 3, 2019 at 8:09 pm #1062386Thanks 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, 9 months ago by bulewold.
February 4, 2019 at 6:38 pm #1062780Hi 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,
NikkoFebruary 21, 2019 at 5:43 pm #1070037Great, thank you so much!!! :D
February 22, 2019 at 3:49 am #1070177Hi bulewold,
Glad that we could help you :)
Thanks for using Enfold and have a great day!Best regards,
Nikko -
AuthorPosts
- The topic ‘Display excerpt and read more link on archive/category/type pages’ is closed to new replies.