Support

Account

Home Forums Add-ons Options Page Can't get values from Options page to show in front

Helping

Can't get values from Options page to show in front

  • I realy don’t understand why i can’t get the values from my options page to show in the front. I have created a options page like this:

    if ( function_exists( 'acf_add_options_page' ) ) {
        acf_add_options_page( [
            'page_title' => 'Webbplats inställningar',
            'menu_title' => 'Webbplats inställningar',
            'menu_slug'  => 'webbplats-inställningar',
            'capability' => 'manage_options',
            'post_id'    => 'webbplats-inställningar',
            'redirect'   => false,
            'icon_url'   => 'dashicons-buddicons-replies',
        ] );
    }

    And then created fields to that page. And filled in the fields with my data but when i try to get in in my tamplate like this…:

    <?php the_field('gatuadress', 'option') ?>

    it does not work…
    I see all the fields in the options table in the database. I have also tried to display the fields in diffrent tamplates around the website and none of them work.
    Am I missing something vital or what? I am realy confused.

  • You have set the post id

    
     'post_id'    => 'webbplats-inställningar',
    

    you need to use this post id

    
    <?php the_field('gatuadress', 'webbplats-inställningar') ?>
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.