Archived topic
Customizing the blog, does not apply the design of the first post.
5 replies · Started by Carlos on February 27, 2023
Hello, I have made a content template block to customize the blog, when indicating infinite scrolling in the wordpress customizer, the posts are loaded when I scroll down but the design of the first ones is not applied. How can I make all posts have the same design?
Hi there,
try adding this PHP Snippet, so the Query Loop Block is ignored in the infinite scroll:
add_filter( 'post_class', function( $classes ) {
$infinite_scroll_item_index = array_search( 'infinite-scroll-item', $classes );
if ( in_array( 'gb-query-loop-item', $classes ) && $infinite_scroll_item_index !== false ) {
unset( $classes[ $infinite_scroll_item_index ] );
}
return $classes;
} );
Excuse me and thanks for your answer, where do I have to add the PHP code snippet?
Hi Carlos,
You can use one of the methods introduced here to add PHP code:
https://docs.generatepress.com/article/adding-php/
Thank you very much for the solution,
I have incorporated the code in the child theme's functions.php file and it has worked perfectly.
Glad to hear that worked