vendredi 24 juin 2016

php if else syntax with if ( is_front_page() )

I have a variable which can have three value. If the variable equal the second value, i want the code to be display only if it's on the front page. So the question is how to inlude an if in an elseif ?

function add_preloader(){
    if (  $preloader_val == 'page') {
     echo "<section class='loading-overlay'>

        <div class='loader-inner ball-grid-pulse'>


        </div>

  </section>";
} elseif ($preloader_val == 'homepage') {
if ( is_front_page() ) { 
  echo"<section class='loading-overlay'>

        <div class='loader-inner ball-grid-pulse'>


        </div>

  </section>";
} elseif ($preloader_val == 'none') {
  return;
}
    }

Aucun commentaire:

Enregistrer un commentaire