Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Center area post/pages (http://forum.bytesforall.com/forumdisplay.php?f=32)
-   -   Where to put php template tags? (http://forum.bytesforall.com/showthread.php?t=19566)

emanuel1969 Feb 5, 2013 01:44 PM

Where to put php template tags?
 
Hi. I just started using a plugin that allows me to assign a unique image to each of my categories, and then use a template tag to display that image within a post (anywhere inside the loop). I want to display it in the kicker or byline area, but we're not allowed to put php in the theme options. Here's the tag I want to use:

<?php c2c_the_category_image(); ?>

Where should I put this to make the image appear in the kicker or byline area?

Thanks!

lmilesw Feb 5, 2013 02:40 PM

You could put the code for a new widget area in the kicker box and then add your code using a php aware widget.

emanuel1969 Feb 5, 2013 03:00 PM

Is that a special kind of widget? Do I need a plugin for that?

But also, isn't there a place within the Atahualpa files where I could add it?

lmilesw Feb 5, 2013 03:40 PM

I don't remember the name of the plugin off hand but if you do a search on wordpress.org it shouldn't be hard to find. I would add the new widget area code to the kicker box. If you add it to a theme file it will get overwritten with a theme upgrade. The only time I edit theme files is when there is a patch.

emanuel1969 Feb 5, 2013 07:26 PM

Well according to the instructions in the "Add New Widget Area" section, the only way to add a widget area to the center column is to edit a theme file. Here is what it says:

"Style & edit CENTER COLUMN: If you want to add a widget area to the Center Column, you must edit "index.php" in the theme folder and add the widget area code there."

Interestingly, just below that it says:

"Technically, you could also hard code widget areas into one of the Atahualpa files such as index.php, header.php or footer.php (by using the code as shown below). You should avoid this though, because you'd have to re-do these file edits whenever you upgrade to a new version of Atahualpa."

So if I have to edit the theme file anyway, I might as well just post the php tag directly, right? This saves a step rather than hardcoding a widget area, installing a php compatible text widget, and then putting the php tag in the widget.

Or am I missing something?

And lastly, I actually have been able to make the image appear by putting the php tag right in the index.php file, either just above or just below the kicker box. But if I wanted to make it appear *inside* the kicker box, on the same line, that is, with the rest of the kicker, where would I put the tag? Here is the tag:

<?php c2c_the_category_image(); ?>

And here is the kicker box tag inside the index.php file (along with the line just below it):

<?php bfa_post_kicker('<div class="post-kicker">','</div>'); ?>
<?php bfa_post_headline('<div class="post-headline">','</div>'); ?>

lmilesw Feb 5, 2013 08:22 PM

I would add the new widget code to one or all of the kicker boxes in the "Edit Post/Page Info items" section of the theme options. Then I would install this plugin which provides a widget where you can put php code.

emanuel1969 Feb 5, 2013 11:03 PM

Ok well just to be sure here... you are telling me to ignore the instructions in Atahualpa itself. The instructions clearly say this:

"If you want to add a widget area to the Center Column, you must edit "index.php" in the theme folder and add the widget area code there."

I'll give it a try.

emanuel1969 Feb 5, 2013 11:57 PM

Well it's working with one exception. I put new widget code in all three kicker boxes (home page, multi-post pages and single-post pages), but my new widget areas are only appearing in two of them. It is not appearing in multi-post pages. I have refreshed and refreshed many times.

That said, the plugin you gave me works fine. So all is well except I can't get that third widget area to appear.

BTW, I added three different new widget areas, meaning they all have different names. I did not put the same new widget code into all three kicker boxes. Was that correct?

lmilesw Feb 6, 2013 11:14 AM

I would put the same widget area code in all the boxes.


All times are GMT -6. The time now is 08:51 AM.

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