Hi there,
I have created a settings page with one custom field (single_image). I would like to display the image in the header of my website next to my logo.
I tried to use this shortcode but the image is not showing up: [rwmb_meta id="single_image_qn3i1fz9we"]
Alternatively I tried to add the code to This is the theme file:
<?php
/**
* Template part for displaying the header branding/logo
*
* @package kadence
*/
namespace Kadence;
rwmb_the_value( $single_image_qn3i1fz9we, array( 'size' => 'thumbnail' ) );
?>
<div class="site-header-item site-header-focus-item" data-section="title_tagline">
<?php
/**
* Kadence Site Branding
*
* Hooked Kadence\site_branding
*/
do_action( 'kadence_site_branding' );
?>
</div><!-- data-section="title_tagline" -->
But I don see the image show up next to the logo either. Could you please show me how I should add the image to the above template?
This is how I have set up the settings page and single_image field:
//JP Metabox.io create settings page
add_filter( 'mb_settings_pages', 'location_specific_settings' );
function location_specific_settings( $settings_pages ) {
$settings_pages[] = [
'menu_title' => __( 'Location Specific Settings', 'location-specific-settings' ),
'option_name' => 'Location Specific Settings',
'position' => 25,
'parent' => 'index.php',
'style' => 'no-boxes',
'columns' => 1,
'icon_url' => 'dashicons-admin-generic',
];
return $settings_pages;
}
// JP add logo custom field to settings page
add_filter( 'rwmb_meta_boxes', 'custom_logo' );
function custom_logo( $meta_boxes ) {
$prefix = '';
$meta_boxes[] = [
'title' => __( 'Logo', 'logo' ),
'id' => 'logo',
'settings_pages' => ['location-specific-settings'],
'fields' => [
[
'name' => __( 'Single Image', 'logo' ),
'id' => $prefix . 'single_image_qn3i1fz9we',
'type' => 'single_image',
'image_size' => 'medium',
],
],
];
return $meta_boxes;
}