Support

Account

Home Forums Add-ons Options Page Create a group field in options page

Solving

Create a group field in options page

  • How can I get a field group created in options page?
    I’ve added <?php the_field(‘custom_title’, option); ?>
    Thanks

  • I’m not sure I understand what you’re looking for but

    1) You create an options page https://www.advancedcustomfields.com/resources/options-page/

    2) You set the location rules for the field group to display on the options page you created.

  • I’ve create options page.
    I’ve also create a group.

    Now in rules I’ve added grupo field in options page.

    I’ve a problem with code, works only outside options page:

       <?php
    $hero = get_field('test');	
    if( $hero ): ?>
    <?php echo $hero['gruppotest']; ?>
    <?php endif; ?> 

    Works only if field is outside option page.
    I’ve insert ‘option’ but I received an error
    <?php echo $hero['gruppotest', option]; ?>
    Thanks

  • to get a value from an options you need to supply ‘options’ as the post id in get_field()

    
    <?php
    $hero = get_field('test', 'option');	
    if( $hero ): ?>
    <?php echo $hero['gruppotest']; ?>
    <?php endif; ?>
    
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.