1 to 3 of 3
I have some categories in my blogs where the posts have very little text, or they are just a video with some tags. These posts of course look awkward with an inline ad of 300x250... ;-)
Could not find anything on the forum or docs, so is there any way to limit the display of any ad type to selected categories and/or exclude selected categories from ad display?
Thanks!
Martin, happily playing with his newly purchased OIOpub
Hi Martin,
There's no way at the moment to exclude inline ads from certain categories. There are a couple of options open to you however:
1.) Use a banner zone instead, and manually edit your template to show that banner zone in a post. You could then use an if conditional around the banner zone to exclude categories.
2.) A similar approach to number 1, but instead you edit the OIOpublisher code itself. You'd need to edit the platform/wordpress/inline.php file to do this.
NB: the code below is off the top of my head, and I can't guarentee it will work for all versions of Wordpress
CATEGORY CONDITIONAL:
$category = get_the_category(); //get post category data
$cat_id = $category->cat_ID; //current post category ID
$exclude_cats = array( 1, 4, 5 ); //exclude category IDs
if(!in_array($cat_id, $exclude_cats)) {
//OUTPUT CODE HERE
}
If you were editing the OIOpublisher file, it might be best to flip that code around a bit. You'd put the code below at the top of the "ads_output" function:
$category = get_the_category(); //get post category data
$cat_id = $category->cat_ID; //current post category ID
$exclude_cats = array( 1, 4, 5 ); //exclude category IDs
if(in_array($cat_id, $exclude_cats)) {
return $content;
}
Which ever way you decided to do it (the first is better for upgrading OIO later, as there are no core changes), you'll need to define the category IDs you don't want to show ads on manually.
wow, thanks for that detailed info, Simon!
will try your suggestions.
... guess the list of feature requests is growing by the hour, but I would like to add some kind of category-management to the queue...
Something like the "advanced category excluder", a plug where you can define from which cat articles should not be shown on the front page. similar interface to choose categories for every ad type and/or banner zone, would make things a lot easier.
all best and thanks again
Guess I will show up with more questions soon ;-), will fully implement OIO next week...
1 to 3 of 3