Forum Replies Created
Viewing 5 posts - 1 through 5 (of 5 total)
-
AuthorPosts
-
87Pancakes
ParticipantOk no worries. It's just not justifiable at the cost unfortunately so I will opt for coding the required number of boxes for the job. Thank-you for your help.
87Pancakes
ParticipantThank-you ๐
87Pancakes
ParticipantI figured this out;
Here's the answer if anyone has the same question;
<?php // Register settings page. In this case, it's a theme options page add_filter( 'mb_settings_pages', 'prefix_options_page' ); function prefix_options_page( $settings_pages ) { $settings_pages[] = array( 'id' => 'options', 'option_name' => 'options', 'menu_title' => __( 'Options', 'textdomain' ), 'icon_url' => 'dashicons-edit', 'style' => 'no-boxes', 'columns' => 1, 'tabs' => array( 'general' => __( 'General Settings', 'textdomain' ), ), 'position' => 2, ); $settings_pages[] = array( 'id' => 'work', 'option_name' => 'work', 'menu_title' => __( 'Work', 'textdomain' ), 'icon_url' => 'dashicons-edit', 'style' => 'no-boxes', 'columns' => 1, 'tabs' => array( 'featured' => __( 'Featured Work', 'textdomain' ), ), 'position' => 2, ); return $settings_pages; } // Register meta boxes and fields for settings page add_filter( 'rwmb_meta_boxes', 'prefix_options_meta_boxes' ); function prefix_options_meta_boxes( $meta_boxes ) { $meta_boxes[] = array( 'id' => 'general', 'title' => __( 'General', 'textdomain' ), 'settings_pages' => 'options', 'tab' => 'general', 'fields' => array( array( 'name' => __( 'Logo Dark', 'textdomain' ), 'id' => 'logo_dark', 'type' => 'file_input', ), array( 'name' => __( 'Logo Light', 'textdomain' ), 'id' => 'logo_dark', 'type' => 'file_input', ), ), ); return $meta_boxes; }87Pancakes
ParticipantHi, it's in the header.
I'm just using the code on this page;
https://metabox.io/docs/mb-settings-page/I have fixed it now using the following code;
<?php $field_id = 'twitter-url'; if ( isset( $settings[$field_id] ) ) { echo '<li><a href=" ' . $settings[$field_id] . '"><i class="fa fa-twitter"></i></a></li>'; } ?>How do I echo nothing if the field is empty?
87Pancakes
ParticipantAny help would be greatly appreciated. ๐ Thank-you.
-
AuthorPosts
Viewing 5 posts - 1 through 5 (of 5 total)