Hey @viniciusmaroli,
If you’re comfortable with PHP, you can use the themeisle_gutenberg_posts_block_query filter that is a part of Otter to override the query and increase the number of posts.
This will, however, change things for each and every Posts block that you use (unless you add certain conditions or checks depending on your website).
We wouldn’t recommend loading too many posts as it can slow down your website, specially if you’re also showing images.
Thank you Hardeep, how can I use the themeisle_gutenberg_posts_block_query? I only have one post block, so there won’t be too many problems.
Hey @viniciusmaroli,
You can use something like this:
function increase_post_count_otter( $params ) {
$params['numberposts'] = -1;
return $params;
}
add_filter( 'themeisle_gutenberg_posts_block_query', 'increase_post_count_otter' );
-1 tells WordPress to show all the posts. You can also set it to a specific number.
Thank you very much Hardeep, where I put this code? On the functions.php file?
If you do that, the changes will be gone as soon as you update your theme. You can try using a plugin like https://ww.wp.xz.cn/plugins/code-snippets/ to add custom PHP.
Hardeep, I will be forever grateful. Thank you very much!!!
Let me know if it worked for you.
Awesome. Let us know if you ever have any issues with Otter. Have a great day ahead!