Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save mehedicsit/a538990640df1b3cae00 to your computer and use it in GitHub Desktop.

Select an option

Save mehedicsit/a538990640df1b3cae00 to your computer and use it in GitHub Desktop.
wp register custom post code and register sidebar code include it in functions.php
<?php
/********
*custom post type for slider an services
*********/
function zBoom_slider(){
register_post_type('zBoom_slider',array(
'label'=>'slider',
'labels'=>array(
'name'=>'slider',
'singular_name'=>'add here slider',
'add_new_item' =>'add new slider',
),
'public'=>true,
'supports'=>array('title','editor','thumbnail','excerpt')
));
//custom post type for sevices area
register_post_type('zBoom_sevices',array(
'label'=>'slider',
'labels'=>array(
'name'=>'services',
'singular_name'=>'add your services content here',
'add_new_item'=>'add new sevices here',
),
'public'=>true,
'supports'=>array('title','editor','excerpt','thumbnail')
));
//custom post type for gallery
register_post_type('zBoom_gallery',array(
'label'=>'gallery',
'labels'=>array(
'name'=>'image gallery',
'singular_name'=>'add your image here',
'add_new_item'=>'add new photo in gallery',
),
'public'=>true,
'supports'=>array('title','editor','thumbnail')
));
}
add_action('init','zBoom_slider');
//register widget area for sidebar
function zBoom_sidebar(){
register_sidebar(
array(
'name'=>'register sidebar',
'id'=>'right_sidebars',
'description'=>'add your sidebar here',
'before_widget'=>'<div class="box">',
'after_widget'=>'</div></div>',
'before_title'=>'<div class="heading"><h2>',
'after_title'=>'</h2></div><div class="content">',
));
}
add_action('widgets_init','zBoom_sidebar');
//register widget area for contact us sidebar
function zBoom_sidebar_contact(){
register_sidebar(
array(
'name'=>'Contact us sidebar',
'id'=>'contact_sidebar',
'description'=>'add your content here',
'before_widget'=>'<div class="box">',
'after_widget'=>'</div></div>',
'before_title'=>'<div class="heading"><h2>',
'after_title'=>'</h2></div><div class="content">',
));
}
add_action('widgets_init','zBoom_sidebar_contact');
//footer widgets register here
function zBoom_footer(){
register_sidebar(
array(
'name'=>'register footer',
'id'=>'footer_register',
'description'=>'Add here your footer item',
'before_widget'=>'<div class="col-1-4">
<div class="wrap-col"><div class="box">',
'after_widget'=>'</div></div></div></div>',
'before_title'=>'<div class="heading"><h2>',
'after_title'=>'</h2></div><div class="content">',
));
}
add_action('widgets_init','zBoom_footer');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment