Support » Fixing WordPress » When is a page not a page? is_page()

Viewing 7 replies - 1 through 7 (of 7 total)
  • Christine Rondeau

    (@crondeau)

    Volunteer Forum Moderator

    I’m sorry but I don’t understand what you mean by:

    only store and contact show as pages with is_page()
    (ultimately, i need to do is_page(array('blog','store','contact'));)

    Why do you need to do an array.. what for? What are you trying to accomplish?

    what i need to do is if it is one of those 3 pages, display a different header. actually, I have it working (except for the blog, still) right now. Basically, I’m taking out the huge header for those 3.
    http://www.paul-ashby-crane.co.uk/
    the top three links, store,blog,contact
    only store and contact return true with is_page() and they are all 3 pages, not posts or categories, etc.

    thanks

    Christine Rondeau

    (@crondeau)

    Volunteer Forum Moderator

    An easier thing to do would be to make use of the body_class()

    That will give you a specific class for each page and then you can easily assign a style for each.

    yes, but there may be other reasons (that cannot be styled) for needing to find out if a page is_page() or not. Do you know why is_page() is returning false for http://www.paul-ashby-crane.co.uk/blog/ ?

    Christine Rondeau

    (@crondeau)

    Volunteer Forum Moderator

    Because blog is not page. Blog is using the index.php. If you add the body_class() to your body tag, it will confirm this.

    actually, it is using template-blog.php (which is the duplicated from index.php). Whooops! I have the page titled blog set to template-blog.php but it is not using it, it is using index.php. My menu is set to ‘page’:blog. My blog page is blank though… is wp deciding that ‘blog’ means something other than my page? Ah, thats it, cuz i just trashed my blog page and it still gives me the same thing.

    Christine Rondeau

    (@crondeau)

    Volunteer Forum Moderator

    Your site is displaying blog posts on your blog, thus it’s not a page and there’s no need for the template-bog.php. That’s just how WordPress works.

    I usually create a page called blog and in the settings reading, set up another page as my static front page and the page blog to display my posts. When you do that, your blog posts use index.php to display the posts.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘When is a page not a page? is_page()’ is closed to new replies.