0

I have created a repeatable field with CMB2, and created a normal field. This is the function of https://pastebin.com/XUQgkvbi

If you use foreach for repeatable using a post or page then you can show data as: https://pastebin.com/C35vWGDs

And Call normal field without repeatable, then

<?php $ entries = get_post_meta (get_the_ID (), 'yourprefix_group_demo', true); ?>

<?php echo $ entries; ?>

also work.

But the problem is, I do not want to use the above function on any page or post. I want to use it in the Options Page. The above Function option has been added to the option page, but I can not do the data show of those files in any way. I've tried get_post_meta () and get_option () with two functions, but in no way can I show data from the option page. How can I get the data from the above fields (option page) to the show in the frontend? Please help with a little bit.

ekad
  • 14,436
  • 26
  • 44
  • 46
Md Abul Bashar
  • 75
  • 2
  • 12

1 Answers1

1

I got solution, The options are stored in a single option field. You would loop through the news-section groups with something like this:

$settings = get_option( 'repeatable-news-options.php', array() );

if ( ! empty( $settings['news-section'] ) ) {
    foreach ( $settings['news-section'] as $section ) {
        echo $section['title'] . '<br/>';
    }
}

that link https://wordpress.org/support/topic/how-to-display-data-from-cmb2-option-page/

problem solved.

Md Abul Bashar
  • 75
  • 2
  • 12