I feel like this has an obvious answer, but I’ve yet to find it. I have a few custom fields bound to a page type, but I’m unsure how to retrieve the value of these fields in my template. All resources reference the_field()
and/or get_post_meta()
, but both of these are for posts, not pages. Any advice?
I had the same problem and this Is what I found out. So firstly you must get the ID of your page.
$page_for_posts = get_option( 'page_for_posts' );
after that, you can pass it to get_fields();
$fields=get_fields($page_for_posts);
this will give you all of the information about the page.
There may be a better solution but this is what I came up with