WordPress.org

Ready to get started?Download WordPress

Forums

How to Display Specific Post ID (help) (4 posts)

  1. archi27
    Member
    Posted 1 year ago #

    Wanted to display specific post id in homepage. Did try to edit but no luck, the custom functions.php:

    function the_crumbs() {
    if (!is_home()) {
    echo 'You are here: <a href="';
    echo get_option('home');
    echo '">';
    echo 'Home'; // Home Link Text, change this to meet your needs
    echo "   »  ";
    if (is_category() || is_single()) {
    the_category(', ','&title_li=');
    if (is_single()) {
    echo "  »  ";
    the_title();
    }
    } elseif (is_page()) {
    echo the_title();
    }}}

    Anyone who knows how?

  2. PinkishHue
    Member
    Posted 1 year ago #

    I think you will need to give some info, I'm not sure what you mean. You want to display a post id in the home page. Does this mean -

    - you want to display the whole post including the title and content?

    - you want to display just the ID number for the post?

    - you want to display the post ID in the breadcrumbs?

    Please can you give us some more info.

    Thanks

  3. archi27
    Member
    Posted 1 year ago #

    Yes, that's it I want to display the post ID in the breadcrumbs. Above is the current code in my theme, I am still a beginner for this. I really appreciate your help.

  4. PinkishHue
    Member
    Posted 1 year ago #

    Ok, I *think* this should work but haven't tested it -

    Add the_ID();

    next to

    the_title();

    so it's like

    the_title(); the_ID();

    Or you could display it differently like:

    the_title(); - the_ID();

    which will look like 'Something post name - 255'
    or

    the_title(); <em>the_ID();</em>

    which should look like 'Something post name 255'

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.