I don't want to display the ad in a few posts for a specific category (cat1, cat2).

Here's the ad code to display the ad on single.php

<?php get_template_part( 'template-parts/ads/below-header' ); ?>
  • 1
    What is the ad you're referring to? Not everybody uses or knows how your theme works so you need to share this information. E.g. my site doesn't have a template-parts folder and does not have advertisements, so I don't know what template-parts/ads/below-header contains or where that line is located
    – Tom J Nowell
    Dec 5, 2021 at 16:51
  • check developer.wordpress.org/reference/functions/in_category and the examples therein
    – Michael
    Dec 7, 2021 at 17:15


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.