• 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

Viewing 9 replies - 1 through 9 (of 9 total)
  • 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.

    <?php the_ID(); ?>?

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

    Thread Starter jesusdlg

    (@jesusdlg)

    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.

    https://www.mundoregioviajes.com/

    Jesus

    Thread Starter jesusdlg

    (@jesusdlg)

    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

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

    Thread Starter jesusdlg

    (@jesusdlg)

    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

    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?

    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?

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

    https://codex.www.ads-software.com/Conditional_Tags

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Trying to know the page ID’ is closed to new replies.