Support » Plugin: Ad Inserter - Ad Manager & AdSense Ads » Ad Shows in Attachment

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Spacetime

    (@spacetime)

    Please post screenshot of settings and page url.

    Thread Starter saleho

    (@saleho)

    Thanks for the reply, here the case

    My blog is about design and useing attachment page, it means that 1 post contains at least 10 images which is linked to the attachment page.

    In order to avoid little / thin content, then I take 1 random paragraph from the parent post (single post) to be displayed in attachement page.

    I only use 2 ads because the theme actually has its own ads placement management, I use your great plugin to display Link Ad randomly in the single post only.

    That’s the problem, sometimes the code is displayed in the attachment page (because I tried to take 1 random paragraph from the parent post)

    here the screenshot of the full page of setting page, sorry for the heavy images _http://prnt.sc/c98fzi

    and here the random.php that I use inside the attachment.php

    <?php */random.php to display random paragraph */
    	$par = get_post($post->post_parent);
    	$content = strip_shortcodes($par->post_content);
    	$content = strip_tags($content, $tags);
    	$content = preg_replace('/\[.+\]/','', $content);
     	$content = apply_filters('the_content', $content);
    	$content = str_replace(']]>', ']]>', $content);
    	/* stripping THAT content of tags that may have been added */
    	$content = strip_tags($content, '<p><a>');
    	/* and strip that of any inline styles */
    	$content = preg_replace('/(<[^>]+) style=".*?"/i', '$1', $content);
    	$content = str_replace('</p>','</p>[(.Y.)]',$content);
    	$content = buangsedikit ($content);
    	$xkon   = explode('[(.Y.)]',$content, -1);
    	$ndex  = ($post->ID + date(G)) % count ($xkon);
    	echo '<blockquote>'.$xkon[$ndex].'</blockquote>';
    
    	function buangsedikit($mbok) { /*remove words containing little characters */
    		$crot = explode('[(.Y.)]',$mbok, -2);
    		foreach ($crot as $cret) {
    			if (strlen($cret) > 100) {$mbal .= $cret.'[(.Y.)]';}
    		}
    		return $mbal;
    	}
    ?>
    Plugin Author Spacetime

    (@spacetime)

    Not sure if I understand your problem – how you php files are used.

    What you have posted is not a screenshot of settings – this looks like raw HTML settings page.
    It is not evident which block causes problem and what settings are you using.

    Ad Inserter uses WP hooks to process content. So if you get code blocks inserted this means that the content gets througs Ad Inserter.

    Plugin Author Spacetime

    (@spacetime)

    Are you still having problems?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Ad Shows in Attachment’ is closed to new replies.