WordPress.org

Ready to get started?Download WordPress

Forums

Ad Injection
[resolved] Doesn't Inject Random Ads if Missing (10 posts)

  1. nuganics
    Member
    Posted 1 year ago #

    Example is at http://www.nuganics.com.au/2010/05/23/lizzy-mates-rates-number/

    |_ Max num of random ads per post: 3 for all

    Start the random ad(s) anywhere - on

    Stop the random ad(s) anywhere - on

    Allow random ad on last paragraph - on

    Allow multiple random ads to be injected at the same position - on

    I don't want to add a top or bottom advert as that will effect longer posts.

    I turned off cache to test and get the same result. Insertion mode is "mfunc: Insert ads using cache compatible mfunc tags" as I want to use super cache. Ads are enabled on posts as other post work great eg http://www.nuganics.com.au/2010/09/21/vibram-fivefingers-dont-buy-online/

    In debug mode it mentions "Warning: No paragraph (</p>) tags found." but there is one paragraph. I increase the priority but it didn't change anything.

    I think the issue is that there is no </p> at the end of my post. Something must have gone wrong as normally as I don't think <p> or </p> are shown in the wordpress html editor so I don't know how I could have deleted them. Do you know how I could get back the </p> tags or can you make a option to inject ads if no </p> found at end of post?

    Kind regards
    Tim Lester

    http://wordpress.org/extend/plugins/ad-injection/

  2. reviewmylife
    Member
    Plugin Author

    Posted 1 year ago #

    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?

  3. nuganics
    Member
    Posted 1 year ago #

    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
    -->

  4. reviewmylife
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  5. nuganics
    Member
    Posted 1 year ago #

    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.

  6. reviewmylife
    Member
    Plugin Author

    Posted 1 year ago #

    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;
    }
  7. nuganics
    Member
    Posted 1 year ago #

    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.

  8. reviewmylife
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  9. nuganics
    Member
    Posted 1 year ago #

    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.

  10. reviewmylife
    Member
    Plugin Author

    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic