Skip to content

Instantly share code, notes, and snippets.

@imranhoshain
Created September 17, 2018 05:40
Show Gist options
  • Save imranhoshain/f74d624e21e1c5719894329fb8c97a6d to your computer and use it in GitHub Desktop.
Save imranhoshain/f74d624e21e1c5719894329fb8c97a6d to your computer and use it in GitHub Desktop.
//Metabox
function marvel_cs_metabox_options($options)
{
$options = array(); // remove old options
//All page option meta
$options[] = array(
'id' => 'theme_page_meta',
'title' => 'Page Options',
'post_type' => 'page',
'context' => 'normal',
'priority' => 'default',
'sections' => array(
array(
'name' => 'theme_page_metabox',
'title' => 'Page Options',
'fields' => array(
// begin: a field
array(
'id' => 'enable_title',
'type' => 'switcher',
'title' => 'Enable Page Breadcrumb',
'default' => 'false'
),
// end: a field
)
)
)
);
return $options;
}
add_filter('cs_metabox_options', 'marvel_cs_metabox_options');
//Paste on page.php file
<?php
//Page title condition solve from theme metabox and option
if(get_post_meta( $post->ID, 'theme_page_meta', true )){
$page_meta = get_post_meta( $post->ID, 'theme_page_meta', true );
}else{
$page_meta = array();
}
//Page title condition
if(array_key_exists('enable_title', $page_meta)){
$enable_title = $page_meta['enable_title'];
}else{
$enable_title = true;
}
if($enable_title == true):?>
<!--breadcrumb area start-->
<div class="breadcrumb-area">
<div style="background-image: url(<?php echo get_template_directory_uri() .'/assets/images/who.png'; ?>);" class="marvel-page-title-area section-padding">
<div class="container">
<ul class="breadcrumb-link">
<?php if(function_exists('mj_wp_breadcrumb'))mj_wp_breadcrumb(); ?>
</ul>
</div>
</div>
</div>
<!--breadcrumb area End-->
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment