- This topic has 7 replies, 2 voices, and was last updated 1 week, 3 days ago by .
-
Topic
-
I am probably missing something obvious but can’t get the URL of an image-type field from a Settings page to appear on the front end.
Settings page:
<?php add_filter( 'mb_settings_pages', 'custom_settings_page' ); function custom_settings_page( $settings_pages ) { $settings_pages[] = [ 'menu_title' => __( 'Options', 'project-name' ), 'option_name' => 'my_options', 'position' => 25, 'columns' => 1, 'icon_url' => 'dashicons-admin-generic', ]; return $settings_pages; }
Field group:
<?php add_filter( 'rwmb_meta_boxes', 'custom_sitewide_fields_group' ); function custom_sitewide_fields_group( $meta_boxes ) { $prefix = 'settings_'; $meta_boxes[] = [ 'title' => __( 'Sitewide', 'project-name' ), 'id' => 'sitewide', 'settings_pages' => ['my-options'], 'fields' => [ [ 'name' => __( 'Logo', 'project-name' ), 'id' => $prefix . 'logo', 'type' => 'image', 'label_description' => __( 'Upload/select site\'s logo image', 'project-name' ), 'max_file_uploads' => 1, ], [ 'name' => __( 'Notice', 'project-name' ), 'id' => $prefix . 'notice', 'type' => 'wysiwyg', 'label_description' => __( 'If present, will appear above the site header. Can be used for specials and promotional messages.', 'project-name' ), ], [ 'name' => __( 'Button Background Color', 'project-name' ), 'id' => $prefix . 'button_background_color', 'type' => 'color', ], ], ]; return $meta_boxes; }
Here’s the code that shows just blank output:
<?php $value = rwmb_meta( 'logo', ['object_type' => 'setting'], 'my_options' ); echo $value['url']; ?>
Any idea?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- You must be logged in to reply to this topic.