Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Montezuma Theme (http://forum.bytesforall.com/forumdisplay.php?f=53)
-   -   [SOLVED] How can I add an "if on homepage" condition in sub template? (http://forum.bytesforall.com/showthread.php?t=20203)

Bassquake Apr 25, 2013 10:06 AM

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

juggledad Apr 25, 2013 10:45 AM

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

Bassquake Apr 25, 2013 10:51 AM

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.


All times are GMT -6. The time now is 05:38 PM.

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