';
$attachments = array_filter( explode( ',', $meta ) );
if ( $attachments )
foreach ( $attachments as $attachment_id ) {
$img = wp_get_attachment_image_src($attachment_id, 'thumbnail');
$imgfull = wp_get_attachment_image_src($attachment_id, 'full');
echo '
';
echo '';
echo '';
}
echo '
';
echo ' ' . $field['desc'] . '
';
}
add_filter( 'cmb_render_kad_gallery', 'kadtool_gallery_field', 10, 2 );
function kadtool_gallery_field_sanitise( $field, $meta ) {
if ( empty( $meta ) ) {
$meta = '';
} else {
$meta = $meta;
}
return $meta;
}
$the_theme = wp_get_theme();
if( ($the_theme->get( 'Name' ) == 'Pinnacle' && $the_theme->get( 'Version') >= '1.0.6' ) || ($the_theme->get( 'Template') == 'pinnacle') ) {
add_filter( 'cmb_meta_boxes', 'kadence_pinnacletoolkit_metaboxes', 100 );
}
function kadence_pinnacletoolkit_metaboxes( array $meta_boxes ) {
// Start with an underscore to hide fields from custom fields list
$prefix = '_kad_';
$meta_boxes[] = array(
'id' => 'subtitle_metabox',
'title' => __( "Page Title and Subtitle", 'virtue-toolkit' ),
'pages' => array( 'page' ), // Post type
'context' => 'normal',
'priority' => 'default',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => __( "Subtitle", 'virtue-toolkit' ),
'desc' => __( "Subtitle will go below page title", 'virtue-toolkit' ),
'id' => $prefix . 'subtitle',
'type' => 'textarea_code',
),
array(
'name' => __("Hide Page Title", 'virtue-toolkit' ),
'desc' => '',
'id' => $prefix . 'pagetitle_hide',
'type' => 'select',
'options' => array(
array( 'name' => __("Default", 'virtue-toolkit' ), 'value' => 'default', ),
array( 'name' => __("Show", 'virtue-toolkit' ), 'value' => 'show', ),
array( 'name' => __("Hide", 'virtue-toolkit' ), 'value' => 'hide', ),
),
),
array(
'name' => __("Page Title background behind Header", 'virtue-toolkit' ),
'desc' => '',
'id' => $prefix . 'pagetitle_behind_head',
'type' => 'select',
'options' => array(
array( 'name' => __("Default", 'virtue-toolkit' ), 'value' => 'default', ),
array( 'name' => __("Place behind Header", 'virtue-toolkit' ), 'value' => 'true', ),
array( 'name' => __("Don't place behind Header", 'virtue-toolkit' ), 'value' => 'false', ),
),
),
)
);
$meta_boxes[] = array(
'id' => 'subtitle_metabox',
'title' => __( "Post Title and Subtitle", 'virtue-toolkit' ),
'pages' => array( 'product', 'post', 'portfolio'), // Post type
'context' => 'normal',
'priority' => 'default',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => __( "Post Header Title", 'virtue-toolkit' ),
'desc' => __( "Post Header Title", 'virtue-toolkit' ),
'id' => $prefix . 'post_header_title',
'type' => 'textarea_code',
),
array(
'name' => __( "Subtitle", 'virtue-toolkit' ),
'desc' => __( "Subtitle will go below post title", 'virtue-toolkit' ),
'id' => $prefix . 'subtitle',
'type' => 'textarea_code',
),
array(
'name' => __("Hide Page Title", 'virtue-toolkit' ),
'desc' => '',
'id' => $prefix . 'pagetitle_hide',
'type' => 'select',
'options' => array(
array( 'name' => __("Default", 'virtue-toolkit' ), 'value' => 'default', ),
array( 'name' => __("Show", 'virtue-toolkit' ), 'value' => 'show', ),
array( 'name' => __("Hide", 'virtue-toolkit' ), 'value' => 'hide', ),
),
),
array(
'name' => __("Page Title background behind Header", 'virtue-toolkit' ),
'desc' => '',
'id' => $prefix . 'pagetitle_behind_head',
'type' => 'select',
'options' => array(
array( 'name' => __("Default", 'virtue-toolkit' ), 'value' => 'default', ),
array( 'name' => __("Place behind Header", 'virtue-toolkit' ), 'value' => 'true', ),
array( 'name' => __("Don't place behind Header", 'virtue-toolkit' ), 'value' => 'false', ),
),
),
)
);
$meta_boxes[] = array(
'id' => 'gallery_post_metabox',
'title' => __("Gallery Post Options", 'virtue-toolkit'),
'pages' => array( 'post',), // Post type
//'show_on' => array( 'key' => 'format', 'value' => 'standard'),
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => __("Post Head Content", 'virtue-toolkit' ),
'desc' => '',
'id' => $prefix . 'gallery_blog_head',
'type' => 'select',
'options' => array(
array( 'name' => __("Gallery Post Default", 'virtue-toolkit' ), 'value' => 'default', ),
array( 'name' => __("Image Slider - (Flex Slider)", 'virtue-toolkit' ), 'value' => 'flex', ),
array( 'name' => __("Carousel Slider - (Caroufedsel Slider)", 'virtue-toolkit' ), 'value' => 'carouselslider', ),
array( 'name' => __("None", 'virtue-toolkit' ), 'value' => 'none', ),
),
),
array(
'name' => __("Post Slider Gallery", 'virtue-toolkit' ),
'desc' => __("Add images for gallery here", 'virtue-toolkit' ),
'id' => $prefix . 'image_gallery',
'type' => 'kad_gallery',
),
array(
'name' => __("Max Slider Height", 'virtue-toolkit' ),
'desc' => __("Default is: 400 (Note: just input number, example: 350)", 'virtue-toolkit' ),
'id' => $prefix . 'gallery_posthead_height',
'type' => 'text_small',
),
array(
'name' => __("Max Slider Width", 'virtue-toolkit' ),
'desc' => __("Default is: 848 or 1140 on fullwidth posts (Note: just input number, example: 650, only applys to Image Slider)", 'virtue-toolkit' ),
'id' => $prefix . 'gallery_posthead_width',
'type' => 'text_small',
),
array(
'name' => __("Post Summary", 'virtue-toolkit' ),
'desc' => '',
'id' => $prefix . 'gallery_post_summery',
'type' => 'select',
'options' => array(
array( 'name' => __('Gallery Post Default', 'virtue-toolkit' ), 'value' => 'default', ),
array( 'name' => __('Portrait Image (feature image)', 'virtue-toolkit'), 'value' => 'img_portrait', ),
array( 'name' => __('Landscape Image (feature image)', 'virtue-toolkit'), 'value' => 'img_landscape', ),
array( 'name' => __('Portrait Image Slider', 'virtue-toolkit'), 'value' => 'slider_portrait', ),
array( 'name' => __('Landscape Image Slider', 'virtue-toolkit'), 'value' => 'slider_landscape', ),
),
),
),
);
$meta_boxes[] = array(
'id' => 'video_post_metabox',
'title' => __("Video Post Options", 'virtue-toolkit'),
'pages' => array( 'post',), // Post type
//'show_on' => array( 'key' => 'format', 'value' => 'standard'),
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => __("Post Head Content", 'virtue-toolkit' ),
'desc' => '',
'id' => $prefix . 'video_blog_head',
'type' => 'select',
'options' => array(
array( 'name' => __("Video Post Default", 'virtue-toolkit' ), 'value' => 'default', ),
array( 'name' => __("Video", 'virtue-toolkit' ), 'value' => 'video', ),
array( 'name' => __("None", 'virtue-toolkit' ), 'value' => 'none', ),
),
),
array(
'name' => __('Video Post embed code', 'virtue-toolkit'),
'desc' => __('Place Embed Code Here, works with youtube, vimeo. (Use the featured image for screen shot)', 'virtue-toolkit'),
'id' => $prefix . 'post_video',
'type' => 'textarea_code',
),
array(
'name' => __("Max Video Width", 'virtue-toolkit' ),
'desc' => __("Default is: 848 or 1140 on fullwidth posts (Note: just input number, example: 650, does not apply to carousel slider)", 'virtue-toolkit' ),
'id' => $prefix . 'video_posthead_width',
'type' => 'text_small',
),
array(
'name' => __("Post Summary", 'virtue-toolkit' ),
'desc' => '',
'id' => $prefix . 'video_post_summery',
'type' => 'select',
'options' => array(
array( 'name' => __('Video Post Default', 'virtue-toolkit' ), 'value' => 'default', ),
array( 'name' => __('Video - (when possible)', 'virtue-toolkit'), 'value' => 'video', ),
array( 'name' => __('Portrait Image (feature image)', 'virtue-toolkit'), 'value' => 'img_portrait', ),
array( 'name' => __('Landscape Image (feature image)', 'virtue-toolkit'), 'value' => 'img_landscape', ),
),
),
),
);
$meta_boxes[] = array(
'id' => 'portfolio_post_metabox',
'title' => __('Portfolio Post Options', 'virtue-toolkit'),
'pages' => array( 'portfolio' ), // Post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => __('Project Layout', 'virtue-toolkit'),
'desc' => '