How to add content above footer in posts from specific category

[ad_1]

I think you would also have to check if a single page is being accessed. This can be done with

Untested:

function your_function() { 
if (is_single() && in_category(array ('cars' , 'trucks' ))) {
 echo '<p class="plus-footer">Custom content to insert</p>';
 }
}
add_action('get_footer', 'your_function');

@threadi

Thank you very much !

Your fast response and I learned something new

Tested, works fine !

Also for single, e.g.

if(is_single( 'opel' )){

if(is_single(array( 888, 159, 17 ))){

Greetings !

  • This reply was modified 16 minutes ago by Arteaster.

Glad I could help. You are welcome to set the topic to solved.

 

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