short PHP help

Taha117

New Member
Messages
8
Reaction score
0
Points
0
this is the code that i am using to display certain content on my homepage:

<div id="content">
<?php if(get_option('unnamed_shelf') == 1 && is_home()){ ?>
<?php include(TEMPLATEPATH ."/shelf.php"); ?>
<?php } ?>
<?php if(get_option('unnamed_shelf') != 1 || !is_home()){ ?>
<div class="content-top"></div>
<?php } ?>
<hr />

how can this be edited to show on every page or a specific page of my choice? Please show your solution below
Edit:
Doesnt anyone have a solution? All i want is to know what i should do to make shelf.php show on all my pages, not jus home
 
Last edited:

sybregunne

Member
Messages
54
Reaction score
0
Points
6
I am not an expert or anything but I think you should modify your code from:
PHP:
<div id="content">
<?php if(get_option('unnamed_shelf') == 1 && is_home()){ ?>
<?php include(TEMPLATEPATH ."/shelf.php"); ?>
<?php } ?>
<?php if(get_option('unnamed_shelf') != 1 || !is_home()){ ?>
<div class="content-top"></div>
<?php } ?>
<hr />

to:

PHP:
<?php
  echo "<div id=\"content\">;
  if(get_option('unnamed_shelf') == 1 && is_home()){ 
    include(TEMPLATEPATH ."/shelf.php");
  }
  if(get_option('unnamed_shelf') != 1 || !is_home()){
    echo "<div class=\"content-top\"></div>";
  }
  echo "<hr />";
?>

then you should save this code to a php file...
let's say header.php

then include "header.php";
on top of every page. but this would mean than you would be using php pages all the way.

you could even do a conditional include on top your page e.g.
PHP:
if (is_loggedin()) include "header.php";

and some other stuff.

Hope this helps.
 
Top