Hi, I'm a PHP noob and I need help with a simple PHP function. I need help how can I undisplay a certain text in PHP (when in homepage), just like this function in Wordpress <?php if (!is_home()) { ?> The Text that hides when I am in homepage <?php} ?> PHP: How can I do the same if I'm only into plain PHP? no CMS... I hope PHP gurus here got my point
here on the fly i can tell you to declare a variable $home where it will be filled with your text to be undisplayed
<?php function is_home(){ //Change index.php to the path to your homepage. if($_SERVER['REQUEST_URI'] == /index.php){ $home = 1; } else { $home = 0; } return $home; } ?> That should work. To call upon it, you would have to use something like this: <?php $home = is_home(); if ($home = 1){ //You're on the home page. Display what you want below. } ?> Good?