Black Friday Super Sale 2024 is Coming Soon

WIN AN iPAD, LIFETIME MEMBERSHIP
×

Search Divi Blog Extras Documentation

Search for answers or browse our knowledge base.

Table of Contents
< All Topics
Print

How to display posts from a specific year and filter them by category in Divi Blog Extras?

To display posts from a specific year and filter by categories in Divi Blog Extras, follow this workaround:

  1. Add Custom Code for Year Filtering:
  • Add the following custom code to your child theme’s functions.php file to filter posts by year.
  • In the below code update 321888 to the Page ID where you have added the Divi Blog Extras module. Replace 2024 with the year you want to display.
function test($args) {
	if ( is_page('321888') ) {
		$args['year'] = 2024;	
	}
	return $args;
}
add_filter('divi_blog_extras_query_args', 'test');

2. Set Up Category Filter: Within the Divi Blog Extras module, select the category you wish to display. This ensures that only posts from the specified category are shown.

This code limits posts to the specified year on the designated page.