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 » Montezuma Theme »

[SOLVED] How can I add an "if on homepage" condition in sub template?


  #1  
Old Apr 25, 2013, 10:06 AM
Bassquake
 
2 posts · Apr 2013
Im trying to add an if statement into the header.php which is the sub template of Montezuma.

Ive tried adding at the end of header.php:

Code:
<?php
if ( is_front_page() ) {
    echo "Home";
} else {
    echo "Away";
}
?>
But it doesnt show anything. It works if I hardcode it in head.php so I know the code works.

Ive tried adding a wp_reset_query but that didnt work.

Are conditionals stripped out in virtual templates? If so, how can I add one in?

Kind regards.
  #2  
Old Apr 25, 2013, 10:45 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
only limited php is avaliable in the virtual templates - hence the 'Limited PHP Code' tab in the top right of the when looking at any of the virtual template pages
  #3  
Old Apr 25, 2013, 10:51 AM
Bassquake
 
2 posts · Apr 2013
Yeah I noticed.

I used this in the end:

Code:
<?php bfa_if_front_else( Home, Away ); ?>
Regards

Edit: Any particular reason why its limited php? Seems limiting in itself! Can't do much customising.

Edit2: Is it possible to have php code in that bfa_if_front_else? Seems to only accept plain text. Id like it to print the home_url.

Last edited by Bassquake; Apr 25, 2013 at 11:17 AM.

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a template for a static homepage RichardG Forum How-To 10 Sep 15, 2010 04:49 PM
KICKER: Homepage %category-linked"% causes right sidebars to disappear from homepage Jazoja Post-Kicker, -Byline & -Footer 2 Jun 23, 2010 05:32 PM


All times are GMT -6. The time now is 02:00 AM.


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