SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: How do I identify a page in Wordpress?

  1. #1
    SitePoint Member
    Join Date
    Oct 2004
    Location
    New York
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I identify a page in Wordpress?

    Hey gang,

    I'm customizing wordpress and I created stated pages.

    One page I created is called blog, to be seen as a subpage
    of the website.

    FOr this page I want to create a different header and
    in my template, I want to identify that this is the page
    I'm using for my blog (ie posts page).

    How can i identify this page as my blog page? (posts page)?

    Incidentally, the $post->post_name is giving me the slug "hello-world"
    for the first post ... what I really want to know is that the page is
    my blog page.

    Understand my question? Got an answer?

    (thanks!!!!!)
    Kenn Schroder
    Coaching Sites That Work
    New York, NY

  2. #2
    SitePoint Evangelist bradical1379's Avatar
    Join Date
    Feb 2007
    Posts
    433
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    if ( is_page('page-name') ) {
    
    }

  3. #3
    Non-Member
    Join Date
    Apr 2009
    Posts
    115
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Couldn't you just use $_SERVER['SCRIPT_URI'] and say if that == (your site url) then do whatever you need to do? (I THINK thats how you check the current URL via PHP?

  4. #4
    SitePoint Member
    Join Date
    Oct 2004
    Location
    New York
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Brad, that's a good idea, except there's a little more to the story...

    What I did was create a page and designated that page as the blog and as a result the title of the page is the title of the first post in the blog which will change over time.

    What I want to do is identify this page as the blog and change the header for this page.

    So what I want to do is to be able to identify this page as the blog page within the php.

    Any ideas?

    thanks!!!
    Kenn Schroder
    Coaching Sites That Work
    New York, NY

  5. #5
    SitePoint Member
    Join Date
    Oct 2004
    Location
    New York
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, the "page slug" actually stays the same on the blog page, perhaps i can recognize this ...

    any idea offhand what the variable that holds the page slug name is?
    Kenn Schroder
    Coaching Sites That Work
    New York, NY

  6. #6
    SitePoint Member
    Join Date
    Oct 2004
    Location
    New York
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For what it's worth, what i did was to use

    if ( ! (is_page) )

    to help me identify if the page "is a blog page", i did a check to
    see if it "isn't a static page" which most of my site is.


    I bet it's just confusing to anyone

    Thanks for the support!
    Kenn Schroder
    Coaching Sites That Work
    New York, NY

  7. #7
    SitePoint Addict CWebguy's Avatar
    Join Date
    Mar 2009
    Posts
    247
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check out
    http://codex.wordpress.org/Conditional_Tags

    Look for page specific tags.

    Cheers,

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •