In Post Ads goes into all categories

Hey,

The plugin puts the ad into all our posts instead of just the one category "Badmintonligaen". It has shown it correct before, but has stopped worked. Could you please help.

Br,
Morten

  • Luís
    • Support

    Hi Bilberg ,

    Hope you're doing well today!

    I've confirmed this bug and flagged the developer so they can get it fixed up asap. Either myself or the developer will reply back here once we have pushed a fix out.

    If you have any further questions in the meantime just let us know.

    Cheers, Luís

  • Luís
    • Support

    Hi Bilberg ,

    Hope you're doing well today!

    After spoke with our SLS team (our code experts :slight_smile: ) seems that, the way that the plugin was designed, it can only restrict ad's to show in specific categories, not to restrict ads for showing up in all other categories.

    I.E

    If in "In Post Ads -> Settings" you connect "post categories" to "ad categories", like:

    Post Category 1 -> Ad Category 1

    It will only show ad's from the "Ad Category 1" in the posts of the "Post Category 1".

    Post Category 2 -> Ad Category 2

    It will only show ad's from the "Ad Category 2" in the posts of the "Post Category 2".

    For all the other posts, there will not be any restriction, so, it doesn't seem like a bug, mostly a feature request.

    However, I can suggest you a workaround to achieve it, but we will need to change a plugin core file.

    1) Go to "wp-content/plugins/custom-ads/lib" folder and download the "class_wdca_custom_ad.php" file.

    2) Using a PHP editor search for "populate_cache" function;

    3) After "global $post;" (close to the line 427) try something like:

    if ( !in_category( array ('category-1', 'category-2'), $post) ) {
                return;
    }

    So, this code will check if the post belongs to the "Category 1" or "Category 2", if not, it will not return a custom ad.

    You can use the post categories "slug" or "id" of the categories where you don't want to show the custom ads.

    I hope this information has been helpful. If I can help you in this or other questions, please let me know!

    Cheers, Luís

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.