Get ID of front page Wordpress
In the Wordpress admin settings>reading you can configure the 'frontpage displays as' as being a static page for the front page. Now I would like to retrieve the ID of the selected static page which is set to display as front page. I've tried Googling but to not much avail, thus I was wondering if there is a native function to retrieve this ID. (I don't feel like programming a workaround if there is a native direct function for this).
The ID of the page used as static page is stored in the wp_options WP table, as option_name=page_on_front and option_value=ID of the page. So if you want to retrieve this value, just use get_option('page_on_front').
Here is an idea:
Get the page by Title first
$Page = get_page_by_title( 'test' );
Then, get the ID like this
echo $Page->ID . "<br /><br />";
The easiest way to see the page_id of the static page is to change the static page to another page and then go to Pages and click on the old page. The page_id is displayed in the Permalink above the edit area. After you see the page_id you can change the static page to the old one. The Permalink for the static page does not show the page_id but for all other pages it does.
I was looking for the solution where you select a page as placeholder for the blog archive.
You can do the same, but then query for 'page_for_posts' instead of 'page_on_front'. So:
$pageID = get_option('page_for_posts');
does the trick for that situation.