Home › Forums › Front-end Issues › ACF fields not displaying on 'Posts Page' › Reply To: ACF fields not displaying on 'Posts Page'
Hi @Patrik
When you select a page to act as the ‘Blogs’ archive page, the global $post object does not point to the page called Blog, instead it points to the loop of posts.
This means that ACF will load the data (via get_field) from the wrong place (not page called Blog).
To get around this, you will need to specify the Blog page ID in the get_field function.
something like:
<?php
$post_id = false;
if( is_home() )
{
$post_id = 123; // specif ID of home page
}
$use_sidebar = get_field('use_sidebar', $post_id);
$choose_sidebar = get_field('choose_sidebar', $post_id);
dynamic_sidebar($choose_sidebar);
?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.