Home › Forums › Support › Blog Masonry different layout for Blog front page and for Archives This topic has 12 replies, 2 voices, and was last updated 6 years, 3 months ago by Tom. Viewing 13 posts - 1 through 13 (of 13 total) Author Posts June 23, 2017 at 1:01 pm #338095 Roman Just wandering if it is achievable to have slightly different layouts for 1. Blog front page and for 2. Archive pages, for example: 1. Masonry Block Width – medium Masonry Most Recent Width – large 2. Masonry Block Width – medium Masonry Most Recent Width – medium June 24, 2017 at 12:22 am #338229 TomLead Developer Lead Developer Tough question! Try this (untested): add_filter( 'generate_masonry_post_width', 'tu_custom_masonry_width' ); function tu_custom_masonry_width( $width ) { global $wp_query; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; if ( is_home() ) { if ( $wp_query->current_post == 0 && $paged == 1 ) { return 'width6'; } else { return 'width4'; } } if ( is_archive() ) { return 'width4'; } return $width; } June 24, 2017 at 12:22 pm #338449 Roman Well, it does not work, only one column is displayed. Maybe because I use content/sidebar/sidebar for is_home() and content/sidebar for is_archive(). Thanks June 25, 2017 at 12:46 am #338560 TomLead Developer Lead Developer Can you link me to each respective page? June 25, 2017 at 1:58 am #338577 Roman I am still testing on local host. I am about to go online. As soon as my site is online I will post a link here for you. Thanks August 6, 2017 at 6:25 am #360515 Roman Blog page link: http://telezjetele.cz Archieve page link: http://telezjetele.cz/rubrika/doporucujeme/ August 6, 2017 at 7:37 pm #360785 TomLead Developer Lead Developer It doesn’t look like masonry is turned on. August 16, 2017 at 7:38 am #367279 Roman Sorry, I forgot I don’t use masonry due to lazy loading issues. Can you please modify a/m filter for columns? August 16, 2017 at 6:34 pm #367662 TomLead Developer Lead Developer You could try this: add_filter( 'generate_blog_get_column_count', 'tu_custom_columns_width' ); function tu_custom_columns_width( $width ) { global $wp_query; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; if ( is_home() ) { if ( $wp_query->current_post == 0 && $paged == 1 ) { return 'featured-column'; } else { return 50; } } if ( is_archive() ) { return 50; } return $width; } August 17, 2017 at 12:48 am #367768 Roman It seems it has no effect http://telezjetele.cz/rubrika/doporucujeme/ August 17, 2017 at 9:11 am #368052 TomLead Developer Lead Developer Ok, since we’re just wanting to remove the featured column on any page but the home page, we can do this instead: add_filter( 'post_class','tu_remove_featured_column' ); function tu_remove_featured_column( $classes ) { if ( ! is_home() ) { $classes = array_diff( $classes, array( 'featured-column' ) ); } return $classes; } August 17, 2017 at 12:34 pm #368208 Roman Thank you! August 17, 2017 at 5:16 pm #368362 TomLead Developer Lead Developer You’re welcome 🙂 Author Posts Viewing 13 posts - 1 through 13 (of 13 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In