0

I'm using custom metaboxes on my pages. For example: header icon.

I created a page for the news on my site. I selected it as a blog archive page under Settings->Reading page. Unfortunately I can't get the meta values for this page.

When I create a page for the blog archive is it uses the index.php or the page.php?

I tried to read the metafields using the page id, but unfortunately global $post; echo $post->ID; returned only the id of the first post in the loop.

What is the best way to read meta values on a page, when it's selected as a blog archive?

0

get_queried_object_ID() will return the ID on the page for posts, or get_queried_object() will return the page object containing all its post fields.

Alternately, the ID of the blog page is stored in the option page_for_posts, which is internally how get_queried_object gets the ID of the post object to load.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.