Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works

If statement to control page image title?

  • Please log in to reply




  • Member
  • PipPipPip
  • 109 posts
Hello everyone. I'm new to php and have been recently trying to get a wordpress site up. It's a personal site used for my portfolio. The reason I'm using wordpress, is because I want the ease of updating frequently that it offers (Just uploading new pictures instead of coding them into html every time), plus the use of a blog.

Things have been going well so far, but since I'm new to php I can't figure this out.

My site has a header made from an image that shows my logo and the site name. There is a separate image below that which shows the title of the current page. Now, in html I could just make sure that the certain page html file was linking to the right image, but I find in php, especially in wordpress, that there is no specific 'page' to change the code in. The pages I am using were created in Wordpress under the Write>Page function.

So I thought I could put an if statement in the index.php. This would state:

If this page's title is 'Blog'
Show header_blogtitle.gif

If this page's title is 'About me'
Show header_aboutme.gif


Could anyone tell me the proper way to write that in php?
Or even suggest a better way to have those images change depending upon the page?

Thanks in advance.
  • 0





  • Member
  • PipPip
  • 90 posts
Hi Dreylivude,

How are your pages linked to each other? Is the content loaded from included files? I mean, what does the URL of the About Me/Blog page look like:

index.php?page=blog or index.php?page=about_me << That?


are they static PHP pages?


You cannot grab the pages <head><title></title></head> with PHP because it is a server side language unfortunately :)

Edited by Sp0nge, 30 June 2008 - 06:55 PM.

  • 0

Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP