Hi Tim, WordPress automatically creates the paragraph tags for you when it finds a line gap. It is strange that this page has an opening paragraph, but no closing paragraph.
The lack of the closing paragraph won’t be caused by Ad Injection, but it will prevent Ad Injection from finding a valid ad insertion location.
What are you using to insert the Facebook Like button after the content? Could this be removing the closing paragraph?
Nice work you got it. I was using http://willfults.com/facebook-like-wordpres/ but changed to http://wordpress.org/extend/plugins/facebook-button-plugin/ and works great. Thank you so much.
I have a issue at http://www.nuganics.com.au/2010/08/07/jerry-brunetti-healing-our-land-our-bodies-and-our-communities/ as no ads are displaying
Has </p> but no length. Shouldn’t it still put in ads if “Allow random ad on last paragraph” is ticked or is this against adsense policy?
Debug below.
Kind regards
Tim
<!–
ADINJ DEBUG
Ad Injection in-content injections complete!
No top ad defined in any of the ad code boxes
No bottom ad defined in any of the ad code boxes
Content length=0 (words) Raw character length=443 Paragraph count=1
Top ad paragraph: 0
Bottom ad paragraph: 1
1st Injected random ads range starts at: 1, and ends at: 1
2nd Injected random ads range starts at: 1, and ends at: 1
potential_random_ad_paragraphs:1
No random ads because post length < d
requested_num_rand_ads_to_insert:0
No random ads enabled on this post
Warning: No random ad injection positions
$adinj_total_top_ads_used=1
$adinj_total_random_ads_used=0
$adinj_total_bottom_ads_used=1
random ads start=anywhere – paragraph – 1
random ads end=anywhere – paragraph – 20 fromstart
posttype=post ( single)
currentdate=1337563006 (15481.0533102)
postdate=1281144410 (14828.0603009)
injection mode=mfunc
–>
Hi Tim, if you have ticked the “Allow random ad on last paragraph” and there is a closing paragraph tag then you should get an ad at the end. Could be a bug in Ad Injection. I’m not able to investigate this right now, but I can have a look in about a week.
The thing that puzzles me is this message: No random ads because post length < d
If the length check is set to disabled ‘d’ then I don’t think this message should be printed.
below is the post html shown inside wordpress as that might be breaking something if you can try on your blog.
<object width=”480″ height=”385″><param name=”movie” value=”http://www.youtube.com/v/tVT_56TVe-4&hl=en_GB&fs=1″></param><param name=”allowFullScreen” value=”true”></param><param name=”allowscriptaccess” value=”always”></param><embed src=”http://www.youtube.com/v/tVT_56TVe-4&hl=en_GB&fs=1″ type=”application/x-shockwave-flash” allowscriptaccess=”always” allowfullscreen=”true” width=”480″ height=”385″></embed></object>
Setting page
http://screencast.com/t/4aaGPaDF
http://screencast.com/t/hHrZHoEqdBSm
No rush mate. Get back to me if I can help.
Hi Tim, Thanks for that. I think I have a fix. If you want to try it replace the block starting from line 1219 of ad-injection.php with the code below. This fix will be in the next release (probably in the next few weeks).
$length = $content_length;
$conditionlength = $ops[$prefix.'no_random_ads_if_shorter_than'];
if (!adinj_rule_disabled($conditionlength) && adinj_true_if($length, '<', $conditionlength)){
$debug .= "\nNo random ads because post length < $conditionlength";
return 0;
}
$conditionlength = $ops[$prefix.'one_ad_if_shorter_than'];
if (!adinj_rule_disabled($conditionlength) && adinj_true_if($length, '<', $conditionlength)){
$debug .= "\nOnly 1 random ad because post length < $conditionlength";
return 1;
}
$conditionlength = $ops[$prefix.'two_ads_if_shorter_than'];
if (!adinj_rule_disabled($conditionlength) && adinj_true_if($length, '<', $conditionlength)){
$debug .= "\nLimit on random ads because post length < $conditionlength";
return min(2, $max_num_rand_ads_to_insert);
}
$conditionlength = $ops[$prefix.'three_ads_if_shorter_than'];
if (!adinj_rule_disabled($conditionlength) && adinj_true_if($length, '<', $conditionlength)){
$debug .= "\nLimit on random ads because post length < $conditionlength";
return min(3, $max_num_rand_ads_to_insert);
}
return $max_num_rand_ads_to_insert;
}
I might have a different ad-injection.php Version: 1.2.0.14 to you as line 1219 is
function adinj_category_nicename($category){ return $category->category_nicename; }
in Notepad ++.
so I went to line 1175 and I found a simular piece of code and replaced it with your new code. http://www.nuganics.com.au/2010/08/07/jerry-brunetti-healing-our-land-our-bodies-and-our-communities/ didn’t display ads but their might be something wrong with this post.
Hi Tim,
If I look at the source of that page I see
<!– Cached page generated by WP-Super-Cache on 2012-05-20 18:28:18 –>
So this page hasn’t been cleared from the cache since you made the change.
If I force the page to regenerate by passing in a fake URL parameter then I see three adverts after the video.
sorry about that. Worked perfectly. I tried to donate using the link at http://wordpress.org/extend/plugins/ad-injection/ but didn’t take me to paypal. Get back to me if you still accept donations. Gave it a social blast. Great plugin mate.
Hi Tim, There is a PayPal donate box on the Ad Injection UI (on the right a little bit down the page) if you do want to donate something. Glad the fix worked. It will be released into the main plugin soon, but just keep using your patched version of Ad Injection until you see the next update.