Making wp realise it’s a page, not a post
-
Hi – I have created a page template entitled Clients Page. The template has a loop which displays all post titles and their excerpts, using
query_posts
.I created a page called Clients using the Clients Page template.
In my
sidebar.php
file I use conditional tags to display different things according to the page I’m on. I want something specific displayed when the page is Clients, so I use:elseif (is_page('Clients')) {
The problem I have is that wp doesn’t think the page is Clients. Because I’ve used
query_posts
, it thinks the page is the oldest post in the database. Consequently, the correct code isn’t shown.I guess I could use
is_single('title of the oldest post')
instead of(is_page('Clients'))
, but it’d be a lot better to get wp to recognise the page as Clients.Any ideas how I could do this?
- The topic ‘Making wp realise it’s a page, not a post’ is closed to new replies.