Advanced Custom Fields has a somewhat hidden feature called an Options page. This allows you to create global fields for commonly reused fields logo phone number, logo, sitewide notices, and much more. The flexibility thanks to the fact that you design what you need using a normal field group is incredibly powerful.
In this video, I’ll show you how to create an options page, create a few fields groups, and get them to show in Oxygen Builder. Let me know what you’ll use your Options pages for.
Learn more about my Oxygen Builder course here: https://jonathanjernigan.com/ultimate-oxygen-course/
TCT Code Snippet:
function tct_field($field_name) { return get_field( $field_name, 'option' ); } function tct_field_link($field_name) { //return str_replace(' ', '', get_field( $field_name, 'option' )); return preg_replace("/[^0-9]/", "", get_field( $field_name, 'option' ) ); }
ACF Options Code Snippet: https://www.advancedcustomfields.com/resources/options-page/
if( function_exists('acf_add_options_page') ) { acf_add_options_page(array( 'page_title' => 'Theme General Settings', 'menu_title' => 'Theme Settings', 'menu_slug' => 'theme-general-settings', 'capability' => 'edit_posts', 'redirect' => false )); acf_add_options_sub_page(array( 'page_title' => 'Theme Header Settings', 'menu_title' => 'Header', 'parent_slug' => 'theme-general-settings', )); acf_add_options_sub_page(array( 'page_title' => 'Theme Footer Settings', 'menu_title' => 'Footer', 'parent_slug' => 'theme-general-settings', )); }