WordPress.org

Ready to get started?Download WordPress

Forums

When is a page not a page? is_page() (8 posts)

  1. JFrankParnell
    Member
    Posted 2 years ago #

    http://www.paul-ashby-crane.co.uk/
    the top three links, store,blog,contact
    those are all pages in wp
    only store and contact show as pages with is_page()
    (ultimately, i need to do is_page(array('blog','store','contact'));)

    what gives?

  2. 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?

  3. JFrankParnell
    Member
    Posted 2 years ago #

    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

  4. 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.

  5. JFrankParnell
    Member
    Posted 2 years ago #

    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/ ?

  6. 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.

  7. JFrankParnell
    Member
    Posted 2 years ago #

    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.

  8. 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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags