Support

Account

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);
    ?>