How to display dynamic additional contents on archive pages?

Question

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.

These should work but I haven’t tried it out yet.

Is there any better way to do this?

0
shenkwen 1 month 2022-08-22T13:16:45-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse