Reputation: 5271
I'd like to give my title <?php echo get_the_title(); ?>
conditional statement. If not HOMEPAGE just display whatever it is = <?php echo get_the_title(); ?>
. if HOMEPAGE display THIS IS + <?php echo get_the_title(); ?>
so the syntax should be
<?php
$path = $_SERVER['REQUEST_URI'];
$page = basename($path);
$page = basename($path, '.php');
?>
<?php if($page == 'index')
{echo 'This is'. get_the_title(); }
else
{echo get_the_title();}
?>
the problem is I dont really know in wordpress do we use the same way or something smarter or easier.
OH, FORGOT!
Actually, my index/homepage is not real index, it is the page called "HOMEPAGE "
setting from Reading Settings -> a static page, front page => HOMEPAGE
Thanks for any advice.
Upvotes: 0
Views: 495
Reputation:
place your code in functions.php
function title_edit($title){
if(!is_front_page() || get_post_type() != 'page') return $title;
$title = 'Home: '.$title;
return $title;
}
add_filter('the_title','title_edit');
Upvotes: 1
Reputation: 5271
Problem solved thanks @silentboy
<?php if(is_front_page())
echo 'This is'.get_the_title();
else echo get_the_title(); ?>
Upvotes: 0