identifying the page

  • Author
    Posts
  • #478394

    peggyolympia
    Member

    I want to be able to write my own php code and put it in some of my WordPress pages. First I need to be able to identify wich page I am on. I know it is a simple thing but I just cant seem to figure it out. can I get the id for that page and use it in a if statement? How do I get the id without changing the permalink . I’m not used to WordPress I am used to writing my own code.

    #478505

    timethief
    Member

    @peggyolympia
    Hello there.
    We require the URl for the blog in question when you post to this forum

    This is wordpress.COM dupport forum. Here at wordpress.COM on this multiuser blogging platform, we have free blogs from wordpress.COM that are also free hosted by WordPress.COM.

    We cannot access the HTML or PHP in our underlying templates, let alone, edit it. Are you referring to a wordpress.COM blog or are your referring to a wordpress.ORG install for self hosting?

    Please read this sticky post at the head of the forum so you are clear about the differences between the two > https://en.forums.wordpress.com/topic/please-read-me-first-before-posting?replies=1

    If you are referring to a wordpress.ORG software install then you must post to this support forum > http://wordpress.ORG/support/

    Hope this helps. :)

    #478641

    peggyolympia
    Member

    actually here is the code I was looking for.
    <?php if (is_page()) echo(‘current_page_item’);?>

    this works for all pages but the home page. This code works for trhe home page.

    <?php if (is_front_page()) echo(‘current_page_item’);?>

    #478643

    peggyolympia
    Member

    Thank-You, timethief, for answering my question!!!! I really do appreciate getting answers!!!!

    #478644

    peggyolympia
    Member

    Oops never mind that didn’t quite work.

    #478646

    timethief
    Member

    @peggyolympia
    Hello there.
    We require the URL for the blog in question when you post to this wordpress.com forum.
    Why? Because some days 30% of those who post here are posting to the wrong forum. Here on our free blogs which are also free hosted by wordpress.com we cannot access the files containing the HTML and PHP.

    I believe you are posting to the wrong forum. However, as you failed again to post the URL for the blog in question I cannot verify that. Please read the support documentation I linked to above. because If you are posting questions and answers to wordpres.ORG software question here in the wordpress.COM forum, doing sois bound to cause confusion.

    #478657

    peggyolympia
    Member

    I must have been posting to the wrong forum as you said becouse my site is hosted on a private server. I did however find what I was looking for

    is_page(‘5’)

    :)

    #478669

    timethief
    Member

    I’m glad you found what you needed to find, and also that you understand that you must post to http://wordpress.ORG/support to get help with your wordpress.ORG install.

    Would you like to enter the first post you made to this thread and mark it as “resolved” now?

    Happy blogging. :)

The topic ‘identifying the page’ is closed to new replies.