WordPress.org

Ready to get started?Download WordPress

Forums

PHP Code help...simple if statement (3 posts)

  1. bremmerm
    Member
    Posted 3 years ago #

    HOw can i get the following code to work:

    <?php if(is_home())
    {
    echo "<div id="home-layout1">  <div id="home-layout2"> <div id="home-layout3">"
    } else {
    echo "<div id="home-layout1"> <div id="home-layout2"> <div id="home-layout3">"
    }
    ?>

    Thanks!

  2. bremmerm
    Member
    Posted 3 years ago #

    I figured it out pretty quick! I forgot about the " "

    <?php if(is_home())
    {
    echo " <div id=\"home-layout1\">  <div id=\"home-layout2\"> <div id=\"home-layout3\">";
    } else {
    echo " <div id=\"sub-layout1\"> <div id=\"sub-layout2\"> <div id=\"sub-layout3\"> ";
    }
    ?>
  3. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    <?php if( is_home() ) echo'<div id="home-layout1">  <div id="home-layout2"> <div id="home-layout3">';
    else echo '<div id="home-layout1"> <div id="home-layout2"> <div id="home-layout3">';?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.