Archived

This topic is now archived and is closed to further replies.

  • 0

Inserting an Ad after 1st post

Question

Posted · Report post

I read through this post here and its corresponding links but am wondering if anything changes with PlatformPro. On my old WP blog I was able to insert the following code on the home.php page of my theme, just before <?php enwhile; ?> :

<?php if(!$show_ads){ ?>
	Insert Code Here
	<?php $show_ads = 1; } ?>

Possible with PlatformPro?

Share this post


Link to post
Share on other sites

11 answers to this question

Posted · Report post

line 105 in template.postloop.php, make it this `<?php if(pagelines_show_excerpt( get_the_ID() ) && $count != 1): // Post Excerpt ?>`

Share this post


Link to post
Share on other sites

Posted · Report post

Bravo! Thanks.

Share this post


Link to post
Share on other sites

Posted · Report post

If you place it back in the location where it appeared on every post, we could help you code a simple conditional statement so that it only shows up if and when the post count is 1

Share this post


Link to post
Share on other sites

Posted · Report post

Well, that didn't do it for me. Perhaps I missed something? However, if you go to line 123 in platformpro > template.postloop.php you'll see the last of 3 <?php endif;?> tags. This is just after the first mention of 'continue_reading_text'. I put the aforementioned code there and it seems to work (at least locally using MAMP). This placement of the code also seems to put the ad at the end of any single page past. . . . still testing it though. :)

Share this post


Link to post
Share on other sites

Posted · Report post

Update 1(?) Moving the code down to just after the next <?php endif;?>, which is after the closing <div> for the <div class="entry_content"> works better.

Share this post


Link to post
Share on other sites

Posted · Report post

Dario, I haven't tested this on Platform Pro yet, but there was a solution found via this post: http://www.pagelines.com/forum/topic.php?id=805 This worked on WhiteHouse Pro, but I think the basic concepts of the frameworks may be the same. Hope this gets you 100% there...

Share this post


Link to post
Share on other sites

Posted · Report post

Thanks Michael, I gave that a shot this morning but could not get it to function. I need to play with it some more I guess. In the meantime I moved my fix to the live site and all seems well for now. The ad runs just after the first post on the main blog page. It also runs underneath the post on every page. This last thing was unintended but I kind of like it anyway.

Share this post


Link to post
Share on other sites

Posted · Report post

Hi Adam, I missed this reply until now. So I should put it back and then what? Give you the URL or paste the code here, or . . . ? The conditional might also help my other issue which is making the recent post always display in full and the rest of the posts simply display excerpts. I tried the solution via another thread here but failed.

Share this post


Link to post
Share on other sites

Posted · Report post

Basically to get a full post on the first or most recent post you would make line 125 in template.postloop.php look like this `<?php if(pagelines_show_content( get_the_ID() ) || $count == 1): // Post and Page Content ?>` See the added `|| $count == 1` ? That's the ticket

Share this post


Link to post
Share on other sites

Posted · Report post

Thanks and we're close. But, the most recent post also displays an excerpt, as do the categories pages. See the results here. -I'll stop adjusting for awhile, until this is seen.

Share this post


Link to post
Share on other sites