Wordpress Themes - WP Forum at BFA
Click here to register or to donate.
Auto self-registration is not available here - far too many spammers. This forum has many, many backlinks and because of that there is an intense desire among spammers to drop their links here.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Montezuma Theme »

[SOLVED] Add data under post #'x' in index.php

Old Jan 28, 2013, 02:25 PM
32 posts · Nov 2012
So what I'm trying to accomplish is to add a bit of code underneath the 5th post excerpt listed on the index page.

I've looked at the index.php and see it calls bfa_loop( 'post_format' ), so I thought I might be able to figure out how to do it by looking at the bfa_loop code, but I couldn't find it in the theme files

What I'm thinking will work is if I use some code like this:
<?php if(!$show_code){ ?>
<?php $show_code = 5; } ?>
But I'm not sure what to look at, or where it should be plugged in. Has anyone done anything like this with this theme? Can you point me somewhere?

Old Jan 28, 2013, 04:02 PM
juggledad's Avatar
23,700 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
here is how you can do it.
1) add a dynamic sidebar (it's a widget area) with a name like 'Post widget' where you want it in the post - ie above teh content, below it etc
2) add thte plugin 'exec-php' to your site
3) go to the widget area and add a text widget to the new 'Post Widget' area
4) add some code like this to the text widget
HTML Code:
<?php global $mycount;
$mycount += 1;
if ($mycount == 5) { echo 'ad goes here'; }
echo 'count='.$mycount.'<br>';
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
Old Jan 28, 2013, 07:28 PM
32 posts · Nov 2012
So are you saying I should create a widget area 'inside' of the 'post format' sub template?
Old Jan 28, 2013, 07:52 PM
32 posts · Nov 2012
Thanks, adding the widget area in that position did it! I didn't realize I could add widget areas and not associate them with columns. Thanks for the insight.


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
Full Post on index iSpectra Montezuma Theme 16 Nov 5, 2012 12:11 AM
Add data on post container near the headline guaccio2209 Center area post/pages 0 Nov 6, 2011 11:27 AM
How can I alter index.php to omit certain post data? David Crowther Atahualpa 3 Wordpress theme 1 Oct 4, 2010 08:17 PM
How to not have Google index my sidebar data? gabrielnovo Atahualpa 3 Wordpress theme 5 May 6, 2009 07:46 AM

All times are GMT -6. The time now is 05:31 AM.

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