Forums

Trying to know the page ID (10 posts)

  1. jesusdlg
    Member
    Posted 2 years ago #

    Hello everyone,

    I'm trying to know what's the page id for my home page on my theme. Currently my Home link uses: <?php bloginfo('url'); ?> How can I know what's the page id for my main page blog?

    Thanks in advance to help me out with this

  2. Snat
    Member
    Posted 2 years ago #

    If you are within the loop, this should work.

    <?php the_ID(); ?>

    Then naturally, do what you need once you got the value.

    is_front_page()

    This is used to see if the page loaded is the front page.

    is_home()

    This one is used to see if the page is the home page, which I think may be better for what you are planning to do but without know I can not be sure.

  3. Safirul Alredha (zeo)
    Member
    Posted 2 years ago #

    <?php the_ID(); ?>?

    btw, your home page is Static Page or normal blog post listing?

  4. jesusdlg
    Member
    Posted 2 years ago #

    Hi,

    My home page seems to be like a blog page, as it displays featured post on it and slideshow. But im not so sure as I'm installing a new theme who doesnt have all information about this. Please take a look and thanks for your help.

    http://www.mundoregioviajes.com/

    Jesus

  5. jesusdlg
    Member
    Posted 2 years ago #

    I think its the blog page, but on my header.php my Home link looks like this:

    <!-- Main Menu Links -->
    <ul class="sf-menu">
    <li class="<?php if (is_home()) : echo 'current'; endif; ?>">">Home
    <?php printMenuItems(); ?>

    As I'm using cforms in here, I need to configure the plugin to exclude the cforms headers to print on the mainpage (as that causes a conflict and the slideshow doesnt work), so I just need to know what's the page ID or the just the ID of the mainpage.

    Jesus

  6. Safirul Alredha (zeo)
    Member
    Posted 2 years ago #

    Try this:
    if ( !is_front_page() && !is_home() )

  7. jesusdlg
    Member
    Posted 2 years ago #

    ok, i just replace this:

    <li class="<?php if (is_home()) : echo 'current'; endif; ?>">">Home

    with this:
    <li class="<?php if ( !is_front_page() && !is_home() ) : echo 'current'; endif; ?>">">Home

    Now, how can I know what's the page id? or the if for the main page?

    Thanks in advance!

    Jesus

  8. Safirul Alredha (zeo)
    Member
    Posted 2 years ago #

    There's no page id for the front page. Even if u use the_ID() it will take the latest first post id.

    Unless u are using static Page for front page display.

    btw, when u mean u what to exclude cforms headers is it not to display the link menu for cforms or don't want to print the script (i.e js, css) in the <head>...</head> section?

  9. mrsuperadmin
    Member
    Posted 1 year ago #

    btw, when u mean u what to exclude cforms headers is it not to display the link menu for cforms or don't want to print the script (i.e js, css) in the <head>...</head> section?

    yeah, I want to know how to disable the cforms script in the <head>...</head> on the front page. how?

  10. alchymyth
    The Sweeper
    Posted 1 year ago #

    wrap it into a conditional statement, using is_front_page() or is_home()

    something like:

    <?php if(! ( is_front_page() || is_home() ) ) : ?>
    your cform stuff
    <?php endif; ?>

    http://codex.wordpress.org/Conditional_Tags

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags