- This topic has 12 replies, 2 voices, and was last updated 6 years, 8 months ago by Tom.
-
AuthorPosts
-
June 23, 2017 at 1:01 pm #338095Roman
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 β large2.
Masonry Block Width β medium
Masonry Most Recent Width β mediumJune 24, 2017 at 12:22 am #338229TomLead DeveloperLead DeveloperTough 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 #338449RomanWell, 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 #338560TomLead DeveloperLead DeveloperCan you link me to each respective page?
June 25, 2017 at 1:58 am #338577RomanI 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 #360515RomanBlog page link: http://telezjetele.cz
Archieve page link: http://telezjetele.cz/rubrika/doporucujeme/
August 6, 2017 at 7:37 pm #360785TomLead DeveloperLead DeveloperIt doesn’t look like masonry is turned on.
August 16, 2017 at 7:38 am #367279RomanSorry, 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 #367662TomLead DeveloperLead DeveloperYou 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 #367768RomanIt seems it has no effect http://telezjetele.cz/rubrika/doporucujeme/
August 17, 2017 at 9:11 am #368052TomLead DeveloperLead DeveloperOk, 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 #368208RomanThank you!
August 17, 2017 at 5:16 pm #368362TomLead DeveloperLead DeveloperYou’re welcome π
-
AuthorPosts
- You must be logged in to reply to this topic.