[SOLVED] Ads after first post
Hi and thanks for a great theme.
I'm trying to add some ad code between first and second post on my frontage. I tried the same code as Atahualpa uses but it doesn't work. Code:
<div align="center"> |
Where are you trying to insert your code, in the virtual index.php? And how are you determining whether you are between the first and second posts? You are only allowed to put a limited set of PHP code in the virtual PHP pages. In the upper right corner of the virtual page options is a gray tab labeled Limited PHP Code. If you click on it, you'll be able to see what function calls are allowed. One way to possibly get around this is to define a widget area between your posts, but I don't know how you're going to be able to control which posts it shows up after.
|
put a 'dynamic sidebar' in the location, add a text widget and install the 'exec php' plugin then add your code to the text widget
|
I created a dynamic sidebar but I don't know where "the location" is? I always get my ad below the last post on the front page. Here is my index.php. Where should it be?
Code:
<!--<div id="container">--> |
Unfortunately, there isn't a function that you can use like in Atahualpa to position something after a certain post. However, it's not that difficult to move it around using jquery.
First, enclose the widget area that you've defined in a DIV, and give it a class called Ads_Widget, like this: Code:
<?php bfa_loop( 'postformat' ); ?> Then go to Appearance > Montezuma Options > Head > Insert Code. This section is useful for putting in javascript. If you track your site statistics using something like Google Analytics, for example, this is where you'd put it as well. In the Bottom field, add this: Code:
<script> There are two lines in the function, both of them commented. The first makes a copy of the ads widget and inserts it after the first post. The second line removes the original (i.e., the last) copy of the widget from the bottom of the page. |
Quote:
Code:
function to put in x number of posts |
Quote:
|
Thanks CrouchingBruin, your jquery Code worked perfectly.
|
All times are GMT -6. The time now is 05:28 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.