-
Author
-
December 8, 2015 at 16:11 #91868clynParticipant
I can see the Kleo theme general settings on Kleo post, pages and posrtfolio (to using post format) but cant see the custom post type. I read some forums such as https://archived.seventhqueen.com/forums/topic/add-kleo-meta-box-to-custom-post-type#post-28801
and i added code (above 28801) to my kleo child function.php but nothing chance, still cant see the theme setting on custom Post type.
At the moment i also added ( ‘custom_post_type’ ) some ares on kleo/lib/metaboex.php
Need your help
Thanks
Attachments:
You must be logged in to view attached files.December 8, 2015 at 16:18 #91871clynParticipantAh so sorry, i solve the problem. (‘custom_post_name’) is specific keywords i must use my custom post names such as movie or album etc. I think need more sleep 🙂
Thanks…
December 8, 2015 at 16:23 #91873sharmstrModeratorAlso, dont copy the code directly from that topic. Its a outdated. Copy the current function content from /kleo/lib/metaboxes.php
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
December 8, 2015 at 16:46 #91882clynParticipantsorry but i dont understand whta you mean 🙁
At the moment i dont want to show display and title setting. Just want to show Media (because i have lots of author so they can change the page structure)
December 8, 2015 at 16:50 #91885sharmstrModeratorI mean that the code has probably changed since it was posted to the topic. Go to /kleo/lib/metaboxes.php and make sure you get current code.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
December 8, 2015 at 17:09 #91894clynParticipantActually topic code its working but when i go to kleo/lib/metabox.php and copy to code and paste kleo child fuction (also adding custom post names) giving some errors. I saw there client metabox or testiminiol metabox could they give error?
This is my latest lib/metabox code…. Thank you so much….
<?php
/**
* Include and setup custom metaboxes and fields.
*
*/add_filter( ‘kleo_meta_boxes’, ‘kleo_metaboxes’ );
/**
* Define the metabox and field configurations.
*
* @param array $meta_boxes
* @return array
*/
function kleo_metaboxes( array $meta_boxes ) {// Start with an underscore to hide fields from custom fields list
$prefix = ‘_kleo_’;$meta_boxes[] = array(
‘id’ => ‘general_settings’,
‘title’ => ‘Theme General settings’,
‘pages’ => array( ‘post’,’page’ , ‘event-art’ , ‘portfolio-audition’ , ‘cinema-movie’ , ‘world-festivals’ , ‘architecture-catalog’ , ‘music-album-singer’ , ‘visual-arts’ , ‘organization-company’ , ‘art-resume-cv’ , ‘art-jobs-careers’ , ‘theater-dance’ ), // Post type
‘context’ => ‘normal’,
‘priority’ => ‘default’,
‘show_names’ => true, // Show field names on the left
‘fields’ => array(
array(
‘name’ => ‘Display settings’,
‘desc’ => ”,
‘id’ => ‘kleodisplay’,
‘type’ => ‘tab’
),
array(
‘name’ => ‘Centered text’,
‘desc’ => ‘Check to have centered text on this page’,
‘id’ => $prefix . ‘centered_text’,
‘type’ => ‘checkbox’,
‘value’ => ‘1’
),
array(
‘name’ => ‘Top bar status’,
‘desc’ => ‘Enable/disable site top bar’,
‘id’ => $prefix . ‘topbar_status’,
‘type’ => ‘select’,
‘options’ => array(
array(‘value’ => ”, ‘name’ => ‘Default’),
array(‘value’ => ‘1’, ‘name’ => ‘Visible’),
array(‘value’ => ‘0’, ‘name’ => ‘Hidden’)
),
‘value’ => ”
),
array(
‘name’ => ‘Hide Header’,
‘desc’ => ‘Check to hide whole header area’,
‘id’ => $prefix . ‘hide_header’,
‘type’ => ‘checkbox’,
‘value’ => ‘1’
),
array(
‘name’ => ‘Hide Footer’,
‘desc’ => ‘Check to hide whole footer area’,
‘id’ => $prefix . ‘hide_footer’,
‘type’ => ‘checkbox’,
‘value’ => ‘1’
),
array(
‘name’ => ‘Hide Socket area’,
‘desc’ => ‘Check to hide the area after footer that contains copyright info.’,
‘id’ => $prefix . ‘hide_socket’,
‘type’ => ‘checkbox’,
‘value’ => ‘1’
),
array(
‘name’ => ‘Custom Logo’,
‘desc’ => ‘Use a custom logo for this page only’,
‘id’ => $prefix . ‘logo’,
‘type’ => ‘file’,
),
array(
‘name’ => ‘Custom Logo Retina’,
‘desc’ => ‘Use a custom retina logo for this page only’,
‘id’ => $prefix . ‘logo_retina’,
‘type’ => ‘file’,
),
array(
‘name’ => ‘Transparent Main menu’,
‘desc’ => ‘Check to have Main menu background transparent.’,
‘id’ => $prefix . ‘transparent_menu’,
‘type’ => ‘checkbox’,
‘value’ => ‘1’
),
array(
‘name’ => ‘Transparent Main menu color’,
‘desc’ => ”,
‘id’ => $prefix . ‘transparent_menu_color’,
‘type’ => ‘select’,
‘options’ => array(
array(‘value’ => ‘white’, ‘name’ => ‘White’),
array(‘value’ => ‘black’, ‘name’ => ‘Black’)
),
‘value’ => ‘white’
),
array(
‘name’ => ‘Social share’,
‘desc’ => ‘Display social share at bottom of the single page.’,
‘id’ => $prefix . ‘blog_social_share’,
‘type’ => ‘select’,
‘options’ => array(
array(‘value’ => ”, ‘name’ => ‘Default’),
array(‘value’ => ‘1’, ‘name’ => ‘Visible’),
array(‘value’ => ‘0’, ‘name’ => ‘Hidden’)
),
‘value’ => ”
),array(
‘name’ => ‘Title section’,
‘desc’ => ”,
‘id’ => ‘kleoheader’,
‘type’ => ‘tab’
),
array(
‘name’ => ‘Section Layout’,
‘desc’ => ”,
‘id’ => $prefix . ‘title_layout’,
‘type’ => ‘select’,
‘options’ => array(
array(‘value’ => ”, ‘name’ => ‘Default’),
array(‘value’ => ‘regular’, ‘name’ => ‘Regular’),
array(‘value’ => ‘center’, ‘name’ => ‘Centered’),
array(‘value’ => ‘right_breadcrumb’, ‘name’ => ‘Right Breadcrumb’)
),
‘value’ => ”
),
array(
‘name’ => ‘Custom page title’,
‘desc’ => ‘Set a custom page title here if you need.’,
‘id’ => $prefix . ‘custom_title’,
‘type’ => ‘text’,
),
array(
‘name’ => ‘Hide the title’,
‘desc’ => ‘Check to hide the title when displaying the post/page’,
‘id’ => $prefix . ‘title_checkbox’,
‘type’ => ‘checkbox’,
‘value’ => ‘1’
),
array(
‘name’ => ‘Breadcrumb’,
‘desc’ => ”,
‘id’ => $prefix . ‘hide_breadcrumb’,
‘type’ => ‘select’,
‘options’ => array(
array(‘value’ => ”, ‘name’ => ‘Default’),
array(‘value’ => ‘0’, ‘name’ => ‘Visible’),
array(‘value’ => ‘1’, ‘name’ => ‘Hidden’)
),
‘value’ => ”
),
array(
‘name’ => ‘Hide information’,
‘desc’ => ‘Check to hide contact info in title section’,
‘id’ => $prefix . ‘hide_info’,
‘type’ => ‘checkbox’,
‘value’ => ‘1’
),
array(
‘name’ => ‘Top Padding’,
‘desc’ => ‘Put a value without px. Example: 20<br>Default value is taken from Theme options – Header – Title/Breadcrumb section’,
‘id’ => $prefix . ‘title_top_padding’,
‘type’ => ‘text’,
),
array(
‘name’ => ‘Bottom Padding’,
‘desc’ => ‘Put a value without px. Example: 20<br>Default value is taken from Theme options – Header – Title/Breadcrumb section’,
‘id’ => $prefix . ‘title_bottom_padding’,
‘type’ => ‘text’,
),
array(
‘name’ => ‘Text Color’,
‘desc’ => ‘Override the default text color as set in Theme options – Styling options – Title’,
‘id’ => $prefix . ‘title_color’,
‘type’ => ‘colorpicker’,
‘value’ => ”
),
array(
‘name’ => ‘Background Image’,
‘desc’ => ‘Choose a background image for the section.’,
‘id’ => $prefix . ‘title_bg’,
‘type’ => ‘file’,
‘bg_options’ => ‘yes’
),
array(
‘name’ => ‘Background Color’,
‘desc’ => ‘If an image is not set the color will be used’,
‘id’ => $prefix . ‘title_bg_color’,
‘type’ => ‘colorpicker’,
‘value’ => ”
),array(
‘name’ => ‘Media’,
‘desc’ => ”,
‘id’ => ‘kleomedia’,
‘type’ => ‘tab’
),
array(
‘name’ => ‘Show media on post page’,
‘desc’ => ‘If you want to show image/gallery/video/audio before the post on single page’,
‘id’ => $prefix . ‘post_media_status’,
‘type’ => ‘select’,
‘options’ => array(
array(‘value’ => ”, ‘name’ => ‘Default’),
array(‘value’ => ‘1’, ‘name’ => ‘Yes’),
array(‘value’ => ‘0’, ‘name’ => ‘No’)
),
‘value’ => ”
),
array(
‘name’ => ‘Slider’,
‘desc’ => ‘Used when you select the Gallery format. Upload an image or enter an URL.’,
‘id’ => $prefix . ‘slider’,
‘type’ => ‘file_repeat’,
‘allow’ => ‘url’
),
array(
‘name’ => ‘Video oEmbed URL’,
‘desc’ => ‘Used when you select Video format. Enter a Youtube, Vimeo, Soundcloud, etc URL. See supported services at http://codex.wordpress.org/Embeds.’,
‘id’ => $prefix . ’embed’,
‘type’ => ‘oembed’,
),array(
‘name’ => ‘Video Self hosted(mp4)’,
‘desc’ => ‘Used when you select Video format. Upload your MP4 video file. Setting a self hosted video will ignore Video oEmbed above.’,
‘id’ => $prefix . ‘video_mp4’,
‘type’ => ‘file’,
),
array(
‘name’ => ‘Video Self hosted(ogv)’,
‘desc’ => ‘Used when you select Video format. Upload your OGV video file.’,
‘id’ => $prefix . ‘video_ogv’,
‘type’ => ‘file’,
),
array(
‘name’ => ‘Video Self hosted(webm)’,
‘desc’ => ‘Used when you select Video format. Upload your WEBM video file.’,
‘id’ => $prefix . ‘video_webm’,
‘type’ => ‘file’,
),
array(
‘name’ => ‘Video Self hosted Poster’,
‘desc’ => ‘Used to show before the video loads’,
‘id’ => $prefix . ‘video_poster’,
‘type’ => ‘file’,
),array(
‘name’ => ‘Audio’,
‘desc’ => ‘Used when you select Audio format. Upload your audio file’,
‘id’ => $prefix . ‘audio’,
‘type’ => ‘file’,
)
)
);$meta_boxes[] = array(
‘id’ => ‘post_meta’,
‘title’ => ‘Theme Post Settings’,
‘pages’ => array( ‘post’ ), // Post type
‘context’ => ‘normal’,
‘priority’ => ‘default’,
‘show_names’ => true, // Show field names on the left
‘fields’ => array(array(
‘name’ => ‘Hide post meta’,
‘desc’ => ‘Check to hide the post meta when displaying a post’,
‘id’ => $prefix . ‘meta_checkbox’,
‘type’ => ‘checkbox’,
‘value’ => ‘1’
),
array(
‘name’ => ‘Related posts’,
‘desc’ => ‘Display related posts at bottom of the single post display’,
‘id’ => $prefix . ‘related_posts’,
‘type’ => ‘select’,
‘options’ => array(
array(‘value’ => ”, ‘name’ => ‘Default’),
array(‘value’ => ‘1’, ‘name’ => ‘Visible’),
array(‘value’ => ‘0’, ‘name’ => ‘Hidden’)
),
‘value’ => ”
),
),
);$meta_boxes[] = array(
‘id’ => ‘post_layout’,
‘title’ => ‘Post Layout’,
‘pages’ => array( ‘post’, ‘product’, ‘portfolio’ ), // Post type
‘context’ => ‘side’,
‘priority’ => ‘default’,
‘show_names’ => false, // Show field names on the left
‘fields’ => array(array(
‘name’ => ‘Post layout’,
‘desc’ => ”,
‘id’ => $prefix . ‘post_layout’,
‘type’ => ‘select’,
‘options’ => array(
array(‘value’ => ‘default’, ‘name’ => ‘Default’),
array(‘value’ => ‘right’, ‘name’ => ‘Right Sidebar’),
array(‘value’ => ‘left’, ‘name’ => ‘Left sidebar’),
array(‘value’ => ‘no’, ‘name’ => ‘Full width, no sidebar’),
array(‘value’ => ‘3lr’, ‘name’ => ‘3 columns, Right and Left sidebars’),
array(‘value’ => ‘3ll’, ‘name’ => ‘3 columns, 2 Left sidebars’),
array(‘value’ => ‘3rr’, ‘name’ => ‘3 columns, 2 Right sidebars’),
),
‘value’ => ‘right’
),),
);$meta_boxes[] = array(
‘id’ => ‘header_content’,
‘title’ => ‘Header content(optional)’,
‘pages’ => array( ‘post’, ‘page’, ‘product’ ), // Post type
‘context’ => ‘normal’,
‘priority’ => ‘default’,
‘show_names’ => false, // Show field names on the left
‘fields’ => array(array(
‘name’ => ‘Header content’,
‘desc’ => ‘This will be displayed right after the menu. Shortcodes are allowed’,
‘id’ => $prefix . ‘header_content’,
‘type’ => ‘textarea’,
),),
);$meta_boxes[] = array(
‘id’ => ‘bottom_content’,
‘title’ => ‘Bottom content(optional)’,
‘pages’ => array( ‘post’, ‘page’, ‘product’ ), // Post type
‘context’ => ‘normal’,
‘priority’ => ‘default’,
‘show_names’ => false, // Show field names on the left
‘fields’ => array(array(
‘name’ => ‘Bottom content’,
‘desc’ => ‘This will be displayed right after the generated page content ends. Shortcodes are allowed’,
‘id’ => $prefix . ‘bottom_content’,
‘type’ => ‘textarea’,
),),
);$meta_boxes[] = array(
‘id’ => ‘clients_metabox’,
‘title’ => __(‘Clients – link’, ‘kleo_framework’),
‘pages’ => array( ‘kleo_clients’ ), // Post type
‘context’ => ‘normal’,
‘priority’ => ‘default’,
‘show_names’ => false, // Show field names on the left
‘fields’ => array(
array(
‘name’ => ‘Client link’,
‘desc’ => ‘http://example.com’,
‘id’ => $prefix . ‘client_link’,
‘type’ => ‘text’,
),
)
);$meta_boxes[] = array(
‘id’ => ‘testimonials_metabox’,
‘title’ => __(‘Testimonial – Author description’, ‘kleo_framework’),
‘pages’ => array( ‘kleo-testimonials’ ), // Post type
‘context’ => ‘normal’,
‘priority’ => ‘high’,
‘show_names’ => false, // Show field names on the left
‘fields’ => array(
array(
‘name’ => ‘Author description’,
‘desc’ => ”,
‘id’ => $prefix . ‘author_description’,
‘type’ => ‘text’,
),
)
);//Custom menu
$kleo_menus = wp_get_nav_menus();
$menu_options = array();
$menu_options[] = array( ‘value’ => ‘default’, ‘name’ => ‘Site default’ );
foreach ( $kleo_menus as $menu ) {
$menu_options[] = array( ‘value’ => $menu->slug, ‘name’ => $menu->name );
}$meta_boxes[] = array(
‘id’ => ‘page_menu’,
‘title’ => ‘Main menu options’,
‘pages’ => array( ‘page’, ‘post’ ), // Post type
‘context’ => ‘side’,
‘priority’ => ‘default’,
‘show_names’ => true, // Show field names on the left
‘fields’ => array(array(
‘name’ => ‘Custom menu’,
‘desc’ => ”,
‘id’ => $prefix . ‘page_menu’,
‘type’ => ‘select’,
‘options’ => $menu_options,
‘value’ => ‘default’
),
array(
‘name’ => ‘Hide Shop’,
‘desc’ => ‘Check to hide the Shop icon in the main menu’,
‘id’ => $prefix . ‘hide_shop_icon’,
‘type’ => ‘checkbox’,
‘value’ => ‘1’
),
array(
‘name’ => ‘Hide Search’,
‘desc’ => ‘Check to hide the Search icon in the main menu’,
‘id’ => $prefix . ‘hide_search_icon’,
‘type’ => ‘checkbox’,
‘value’ => ‘1’
),),
);// Add other metaboxes as needed
return $meta_boxes;
}add_action( ‘init’, ‘initialize_meta_boxes’, 9999 );
/**
* Initialize the metabox class.
*/
function initialize_meta_boxes() {if ( ! class_exists( ‘kleo_Meta_Box’ ) ) {
require_once trailingslashit( KLEO_DIR ) . ‘metaboxes/init.php’;
}
}December 8, 2015 at 17:11 #91896sharmstrModeratorJust use the code within the kleo_metaboxes function. Not all of the code in that file.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
December 8, 2015 at 17:19 #91897clynParticipantI think, i cant cut or copy very well because giving php error. Could you copy above my lates lib code please….
December 8, 2015 at 17:21 #91898sharmstrModeratorCant do it now. Im on my phone.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
December 8, 2015 at 17:24 #91899clynParticipantok no problem, when you have time for pc 🙂 thanks… I think some symbol is problem when i cut or copy, this } or 😉
December 8, 2015 at 17:53 #91909clynParticipantDo i really need to add Kleo Child Fuction.php ? Because i only added my custom post names to lib/metabox.php and nothing copy to kleo child fuction, and its working very well? Maybe we dont need anything to add kleo child, becuase maybe you upgrade the theme?
Thanks and sorry my english
December 8, 2015 at 17:58 #91910sharmstrModeratorThat file is overwritten with every kleo update. That’s the point in using a child theme.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
December 8, 2015 at 18:11 #91915clynParticipanti am wasting your time..so i need to wait you to correct code (above my lib/metabox.php) to copy for child fucntion.php
thanks
December 8, 2015 at 18:52 #91920sharmstrModeratorThis should add the media section only
COPY CODEadd_filter( 'kleo_meta_boxes', 'kleo_my_metaboxes' ); function kleo_my_metaboxes( array $meta_boxes ) { $meta_boxes[] = array( 'id' => 'general_settings', 'title' => 'Theme General settings', 'pages' => array( 'my-custom-post' ), // Post type 'context' => 'normal', 'priority' => 'default', 'show_names' => true, // Show field names on the left 'fields' => array( array( 'name' => 'Media', 'desc' => '', 'id' => 'kleomedia', 'type' => 'tab' ), array( 'name' => 'Show media on post page', 'desc' => 'If you want to show image/gallery/video/audio before the post on single page', 'id' => $prefix . 'post_media_status', 'type' => 'select', 'options' => array( array('value' => '', 'name' => 'Default'), array('value' => '1', 'name' => 'Yes'), array('value' => '0', 'name' => 'No') ), 'value' => '' ), array( 'name' => 'Slider', 'desc' => 'Used when you select the Gallery format. Upload an image or enter an URL.', 'id' => $prefix . 'slider', 'type' => 'file_repeat', 'allow' => 'url' ), array( 'name' => 'Video oEmbed URL', 'desc' => 'Used when you select Video format. Enter a Youtube, Vimeo, Soundcloud, etc URL. See supported services at <a target="_blank" href="http://codex.wordpress.org/Embeds">http://codex.wordpress.org/Embeds</a>.', 'id' => $prefix . 'embed', 'type' => 'oembed', ), array( 'name' => 'Video Self hosted(mp4)', 'desc' => 'Used when you select Video format. Upload your MP4 video file. Setting a self hosted video will ignore Video oEmbed above.', 'id' => $prefix . 'video_mp4', 'type' => 'file', ), array( 'name' => 'Video Self hosted(ogv)', 'desc' => 'Used when you select Video format. Upload your OGV video file.', 'id' => $prefix . 'video_ogv', 'type' => 'file', ), array( 'name' => 'Video Self hosted(webm)', 'desc' => 'Used when you select Video format. Upload your WEBM video file.', 'id' => $prefix . 'video_webm', 'type' => 'file', ), array( 'name' => 'Video Self hosted Poster', 'desc' => 'Used to show before the video loads', 'id' => $prefix . 'video_poster', 'type' => 'file', ), array( 'name' => 'Audio', 'desc' => 'Used when you select Audio format. Upload your audio file', 'id' => $prefix . 'audio', 'type' => 'file', ) ) ); return $meta_boxes; }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
December 9, 2015 at 12:01 #92052clynParticipantIts work very well 🙂 thanks your help….
Best Regards
January 3, 2016 at 15:03 #96037jbf388ParticipantHi Sharmstr
While using the above code, does it format the custom post type to video or audio automatically or do we still have to choose the format?
Do you know the code to add the format box?
Thank you
January 4, 2016 at 17:33 #96176sharmstrModeratorYou still need to chose.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
January 4, 2016 at 17:37 #96177sharmstrModeratorSorry, forgot the link to the codex on adding post formats to cpts: https://codex.wordpress.org/Post_Formats
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
-
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.