WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Get the static page IDs in Settings > Reading (3 posts)

  1. SpiritOfTheWinds
    Member
    Posted 1 year ago #

    I was wondering if there was a way to get the pages' ID in the "Settings > Reading" panel for both "Front page" and "Posts page". I'd like to use these options (if set) to add the home page to my custom breadcrumb and the posts page as the "news" page. From that ID, I could get the post title and permalink to set up my breadcrumb...

    I'd prefer using this (if possible) instead of hardcoding it...

    My breadcrumb would then looks like in a post:
    Home > News > My post title (which is renamed into news for this theme)

    Or in a page:
    Home > Parent page > Sub page > Sub sub page

    Any idea how it can be done? I didn't find anything about this... :S

    Thanks!

    P.S. No, I do not use any plugins for my themes, please, do not suggest one.

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    if set under dashboard - settings - reading:

    the static front page id is:

    get_option('page_on_front')

    the posts page id is:

    get_option('page_for_posts')
  3. SpiritOfTheWinds
    Member
    Posted 1 year ago #

    Still can't believe I couldn't find these. I guess I could have if I scrolled through all the options in the options.php page... O.o

    Though I never saw these anywhere through all my searches :S

    Thanks for the help! Will be helpful once I get back to work :)

Topic Closed

This topic has been closed to new replies.

About this Topic