Support

Account

Home Forums General Issues Retrieve Custom Field in Sidebar & Footer Reply To: Retrieve Custom Field in Sidebar & Footer

  • Hi

    In order to display custom field values in the sidebar and the footer.

    You will need to provide a second parameter of the post id to the the_field/get_field function.

    For example

    $post_id = null; // current post
    $post_id = 1; // post 1
    $post_id = "option"; // options page
    $post_id = "options"; // same as above
    $post_id = "category_2"; // target a specific category
    $post_id = "event_3"; // target a specific taxonomy (this tax is called "event")
    $post_id = "user_1"; // target a specific user (user id = 1)
    
    the_field( "text_field", $post_id );
    

    https://www.advancedcustomfields.com/resources/the_field/