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] How can I add an "if on homepage" condition in sub template?


  #1  
Old Apr 25, 2013, 11: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, 11:45 AM
juggledad's Avatar
juggledad
 
23,682 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, 11: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 12:17 PM.

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


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 05:49 PM
KICKER: Homepage %category-linked"% causes right sidebars to disappear from homepage Jazoja Post-Kicker, -Byline & -Footer 2 Jun 23, 2010 06:32 PM


All times are GMT -6. The time now is 11:28 AM.


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