How to display additional contents on archive page?

[ad_1]

I want to display some additional contents on monthly archive pages. The tricky part is, for every month, the addtional contents are different, sometimes it is a chart, sometimes it is a picture, sometimes it is an accordion content, sometimes it is several addtional posts(not from the month).

Is there a nice way to do this?

The only thing I can think of is hacking archive.php and then add a long switch .. case code block, something like

switch ( month )
case '2022-08':
    echo do_shortcode('[elementor-template id="74"]'); 
case '2022-07':
    echo do_shortcode('[elementor-template id="73"]');

Alternatively, I can create categories for each month, and then use advanced custom fields to add month related content to custom fields, then display the fields also by hacking archive.php.

Is there any other better way to do this?

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer