Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages »

How to put code in loop with instruction for single.php?


 
Prev Previous Post   Next Post Next
  #1  
Old Sep 2, 2010, 07:47 AM
annsworld
 
140 posts · Mar 2010
How to put code in loop with instruction for single.php?

Hi,

I want to add a code in each post after the first paragraph. After searching on the internet, I found instructions on how to do that. The isntructions, however, change it in the single.php file.

I think I need to change this in the ATO section (right??):

So I went to ATO / Centre columnd / Style & Edit centre column.

And here is where I get stuck.

The instructions state to replace
Code:
<?php the_content(); ?>
And I cannot find that. So what do I replace instead? Or where do I copy the code in? Or am I totally wrong about this??

Here is the code I should replace the above with:
Code:
<?php
$show_after_p = 1;
$content = apply_filters('the_content', $post->post_content);
if(substr_count($content, '<p>') > $show_after_p)
{
	$contents = explode("</p>", $content);
	$p_count = 0;
	foreach($contents as $content)
	{
		echo $content;

		if($p_count == $show_after_p)
		{
		?>
                INSERT ADSENSE CODE or Any other ads code
		<?
		}
		echo "</p>";
		$p_count++;
	}
}
?>
Thanks in advance for your help!
Ann.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add PHP to the loop on multi- and single post pages only? Fux Center area post/pages 2 Jun 16, 2010 04:55 AM
How to add php code to a 'single' page JakeThePeg Center area post/pages 8 Mar 21, 2010 01:21 AM
Weird Error With Code in Loop as Opposed to index.php adum Post-Kicker, -Byline & -Footer 1 Oct 10, 2009 04:48 AM
Loop Code Displaying Instead of Pages TheInfamousGdub Atahualpa 3 Wordpress theme 6 Aug 27, 2009 08:52 PM
[SOLVED] No sidebar.php...where do I put the code? d_random Atahualpa 3 Wordpress theme 0 Apr 3, 2009 12:42 PM


All times are GMT -6. The time now is 02:58 PM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.