for posts and comments add_theme_support( 'automatic-feed-links' ); //theme is not defining titles on its own add_theme_support( 'title-tag' ); // this theme uses wp_nav_menu() in one location register_nav_menu( 'primary', __( 'Primary Menu', 'boss' ) ); //editor-style.css add_editor_style(); //remove gallery inline style add_filter( 'use_default_gallery_style', '__return_false' ); //gallery images always link to file function boss_gal_link($out){ $out['link'] = 'file'; return $out; } add_filter( 'shortcode_atts_gallery','boss_gal_link'); // this theme uses a custom image size for featured images, displayed on "standard" posts add_theme_support( 'post-thumbnails' ); // set thumbnail sizes set_post_thumbnail_size( 225, 200, true ); // width, height, crop = true //limit excerpt function dp_excerpt_length($length) { return 30; } add_filter('excerpt_length', 'dp_excerpt_length'); } add_action( 'after_setup_theme', 'dp_setup' ); //frontend scipts and styles function dp_frontend_load(){ //css wp_enqueue_style('dp-reset', get_template_directory_uri().'/css/reset.css',array(),null,'all'); wp_enqueue_style('dp-font-awesome', get_template_directory_uri().'/css/font-awesome.css',array(),null,'all'); wp_enqueue_style('dp-googlefonts', '//fonts.googleapis.com/css?family=Lato:400,700|Open+Sans:400,700',array(),null,'all'); wp_enqueue_style('dp-default', get_stylesheet_uri(),array(),null,'all'); wp_enqueue_style('dp-responsive-style', get_template_directory_uri().'/style-responsive.css',array(),null,'all'); //ie-only style sheets global $wp_styles; wp_register_style('dp-ltie9-def', get_template_directory_uri(). '/style.css',array(),null); $wp_styles->add_data('dp-ltie9-def', 'conditional', 'lt IE 9'); wp_enqueue_style('dp-ltie9-def'); wp_register_style('dp-ltie8', get_template_directory_uri(). '/css/stop_ie.css',array(),null); $wp_styles->add_data('dp-ltie8', 'conditional', 'lt IE 8'); wp_enqueue_style('dp-ltie8'); //js wp_enqueue_script('jquery'); wp_enqueue_script('retina_js', get_template_directory_uri() . '/js/retina.min.js', '', '', true ); wp_enqueue_script('startup', get_template_directory_uri().'/js/startup.js', array('jquery')); wp_enqueue_script('dp-imageviewer', get_template_directory_uri().'/js/dp.imageviewer.js', array('jquery')); if( is_single() && comments_open() && get_option( 'thread_comments' )){ wp_enqueue_script( 'comment-reply' ); } //colorizer $dp_color = get_theme_mod('dp_color'); if(!empty($dp_color) && $dp_color != '#990000'){ $extra_css = ' .content a:hover, .content ul:not([class]) li:before, .header .menu li a:hover, .header .menu li a:hover i.fa, footer a:hover, footer a:hover i, a.button, .content a.button, .content p a.button, .content a.dp-button, a.button:hover, .content a.button:hover, .content p a.button:hover, .content a.dp-button:hover, .blog .post-title a:hover, .blog-masonry h3 a:hover, .post .sharing a:hover i, .prev-post a:hover i.fa, .next-post a:hover i.fa, .content .pages-left a:hover, .content .pages-right a:hover, .pages-left a:hover i.fa, .pages-right a:hover i.fa, #pf-category-selector a:hover, #pf-category-selector a.active, .portfolio .item .category, .widget-area a:hover, .widget .tagcloud a:hover, .dp_widget_cats .cloud a:hover, .dp_widget_posts li:hover .title, .dp-iconbox.alignleft i.fa, .dp-iconbox.alignright img.dp-icon, .dp-toggle i, .dp-posts .category, .dp-pricing-table a.dp-button.style2:hover, #responsive-menu:hover i.fa, #respo-menu-holder .menu-responsive > li:hover > a, #respo-menu-holder .sub-menu li:hover a { color: '.$dp_color.'; } .content p a:hover, header, .header .menu .sub-menu, .header .search, .content h1.deco-side, .content h2.deco-side, .content h3.deco-side, .content h4.deco-side, .content h5.deco-side, .content h6.deco-side, a.button:hover, .content a.button:hover, .content p a.button:hover, .content a.dp-button:hover, .blog-masonry .head, .prev-post a:hover i.fa, .next-post a:hover i.fa, .pages-left a:hover i.fa, .pages-right a:hover i.fa, .comments-title, #reply-title, #pf-category-selector a:hover, #pf-category-selector a.active, .footer-widgets, .widget .tagcloud a:hover, .dp_widget_cats .cloud a:hover, .dp-tabs .tabnav-input:checked + .tabnav-label, .dp-pricing-table:hover, .dp-pricing-table a.dp-button.style2:hover, #responsive-menu:hover i.fa { border-color: '.$dp_color.'; } .header .menu > li.current-menu-item, .header .menu > li.current-menu-parent, .header .menu .sub-menu li:hover, .content h1 .deco, .content h2 .deco, .content h3 .deco, .content h4 .deco, .content h5 .deco, .content h6 .deco, .blog .post-date, .blog .post-date span, .widget-title:before, .footer-widgets .widget-title:before, .dp_widget_posts .title:after, .dp-cta .overlay { background-color: '.$dp_color.'; } '; wp_add_inline_style( 'dp-default', $extra_css ); } } add_action( 'wp_enqueue_scripts', 'dp_frontend_load' ); // enqueues scripts and styles for backend function dp_admin_load(){ wp_enqueue_script('dp-admin', get_template_directory_uri().'/js/admin_scripts.js', array('jquery')); } add_action('admin_enqueue_scripts', 'dp_admin_load'); // allow font awesome in tinymce function dp_fa2tinymce($wp) { $wp .= ',' . get_template_directory_uri() . '/css/font-awesome.css'; return $wp; } function dp_tinymce() { add_filter('mce_css', 'dp_fa2tinymce'); } add_action( 'init', 'dp_tinymce' ); // register widgetized areas, and load custom ones also! function dp_widgets_init() { register_sidebar( array( 'name' => __( 'Archives Sidebar', 'boss' ), 'id' => 'posts-widget-area', 'description' => __( 'Sidebar for all Archives, Categories, Tags pages.', 'boss' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => __( 'Search Sidebar', 'boss' ), 'id' => 'search-widget-area', 'description' => __( 'Sidebar for Search page', 'boss' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => __( 'Widget Area #1', 'boss' ), 'id' => 'widget-area-one', 'description' => __( 'Widget area for sidebar or footer', 'boss' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => __( 'Widget Area #2', 'boss' ), 'id' => 'widget-area-two', 'description' => __( 'Widget area for sidebar or footer', 'boss' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => __( 'Widget Area #3', 'boss' ), 'id' => 'widget-area-three', 'description' => __( 'Widget area for sidebar or footer', 'boss' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => __( 'Widget Area #4', 'boss' ), 'id' => 'widget-area-four', 'description' => __( 'Widget area for sidebar or footer', 'boss' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => __( 'Widget Area #5', 'boss' ), 'id' => 'widget-area-five', 'description' => __( 'Widget area for sidebar or footer', 'boss' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => __( 'Widget Area #6', 'boss' ), 'id' => 'widget-area-six', 'description' => __( 'Widget area for sidebar or footer', 'boss' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => __( 'Widget Area #7', 'boss' ), 'id' => 'widget-area-seven', 'description' => __( 'Widget area for sidebar or footer', 'boss' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => __( 'Widget Area #8', 'boss' ), 'id' => 'widget-area-eight', 'description' => __( 'Widget area for sidebar or footer', 'boss' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => __( 'Widget Area #9', 'boss' ), 'id' => 'widget-area-nine', 'description' => __( 'Widget area for sidebar or footer', 'boss' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => __( 'Widget Area #10', 'boss' ), 'id' => 'widget-area-ten', 'description' => __( 'Widget area for sidebar or footer', 'boss' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

' ) ); } add_action( 'widgets_init', 'dp_widgets_init' ); // removes the default styles that are packaged with the recent comments widget function dp_remove_recent_comments_style() { global $wp_widget_factory; remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) ); } add_action( 'widgets_init', 'dp_remove_recent_comments_style' ); // comment functions function tp_validate_gravatar($email) { // Craft a potential url and test its headers $hash = md5(strtolower(trim($email))); $uri = 'http://www.gravatar.com/avatar/' . $hash . '?d=404'; $headers = @get_headers($uri); if (!preg_match("|200|", $headers[0])) { $has_valid_avatar = FALSE; } else { $has_valid_avatar = TRUE; } return $has_valid_avatar; } function dp_comments( $comment, $args, $depth ){ print '
  • '; if(!tp_validate_gravatar(get_comment_author_email())){ //replace to theme avatar print ''; }else{ //default print get_avatar($comment,'60'); } print '

    '.get_comment_author().'
    '; printf( __( '%1$s., %2$s','boss'), get_comment_date('M d, Y'), get_comment_time('H:i') ); edit_comment_link( __( ' (Edit)' ,'boss'), '' ); print ' • '; comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => __('Reply','boss') ) ) ); print '

    '.get_comment_text().'

    '; } // retina image generator function dp_retina_support_create_images( $file, $width, $height, $crop = false ) { if ( $width || $height ) { $resized_file = wp_get_image_editor( $file ); if ( ! is_wp_error( $resized_file ) ) { $filename = $resized_file->generate_filename( $width . 'x' . $height . '@2x' ); $resized_file->resize( $width * 2, $height * 2, $crop ); $resized_file->save( $filename ); $info = $resized_file->get_size(); return array( 'file' => wp_basename( $filename ), 'width' => $info['width'], 'height' => $info['height'], ); } } return false; } function boss_delete_retina_support_images( $attachment_id ) { $meta = wp_get_attachment_metadata( $attachment_id ); $upload_dir = wp_upload_dir(); if(isset( $meta['file'] )){ $path = pathinfo( $meta['file'] ); } if(is_array($meta) && isset($path)){ foreach ( $meta as $key => $value ) { if ( 'sizes' === $key ) { foreach ( $value as $sizes => $size ) { $original_filename = $upload_dir['basedir'] . '/' . $path['dirname'] . '/' . $size['file']; $retina_filename = substr_replace( $original_filename, '@2x.', strrpos( $original_filename, '.' ), strlen( '.' ) ); if ( file_exists( $retina_filename ) ) unlink( $retina_filename ); } } } } } function dp_retina_support_attachment_meta( $metadata, $attachment_id ) { foreach ( $metadata as $key => $value ) { if ( is_array( $value ) ) { foreach ( $value as $image => $attr ) { if ( is_array( $attr ) && !empty($attr['width']) && !empty($attr['height']) ) dp_retina_support_create_images( get_attached_file( $attachment_id ), $attr['width'], $attr['height'], true ); } } } return $metadata; } add_filter( 'delete_attachment', 'boss_delete_retina_support_images' ); add_filter( 'wp_generate_attachment_metadata', 'dp_retina_support_attachment_meta', 10, 2 ); // put theme options in customizer function dp_theme_customizer( $wp_customize ) { //colorizer $wp_customize->add_setting( 'dp_color', array( 'sanitize_callback' => 'sanitize_hex_color', 'default' => '#990000', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'dp_color', array( 'label' => __( 'Main color scheme', 'boss' ), 'section' => 'title_tagline', 'settings' => 'dp_color' ) ) ); //logo $wp_customize->add_setting( 'dp_logo', array( 'sanitize_callback' => 'esc_url_raw', 'default' => get_template_directory_uri() .'/images/logo.png' ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'dp_logo', array( 'label' => __( 'Logo', 'boss' ), 'section' => 'title_tagline', 'settings' => 'dp_logo', ) ) ); //sidebar & footer $wp_customize->add_section( 'dp_sidebar_footer_section' , array( 'title' => __( 'Sidebar & Footer', 'boss' ), 'priority' => 100 ) ); //sidebar position $wp_customize->add_setting( 'dp_default_sidebar_position', array( 'sanitize_callback' => 'dp_sanitize_sb_position' ) ); $wp_customize->add_control( 'dp_default_sidebar_position', array( 'label' => __( 'Default sidebar position', 'boss' ), 'section' => 'dp_sidebar_footer_section', 'type' => 'select', 'choices' => array( '' => __('Right','boss'), 'left' => __('Left','boss') ) ) ); function dp_sanitize_sb_position( $input ) { if($input == 'left'){ return $input; }else{ return ''; } } //footer menu function dp_nav_menu_select(){ $results = ''; $nav_menus = get_terms('nav_menu'); if(!empty($nav_menus)){ foreach($nav_menus as $nm){ $results[$nm->term_id] = $nm->name; } } return $results; } $wp_customize->add_setting( 'dp_footer_menu', array( 'sanitize_callback' => 'dp_sanitize_menu' ) ); $wp_customize->add_control( 'dp_footer_menu', array( 'label' => __( 'Footer menu', 'boss' ), 'section' => 'dp_sidebar_footer_section', 'type' => 'select', 'choices' => dp_nav_menu_select() ) ); function dp_sanitize_menu( $input ) { return $input; } //footer texts $wp_customize->add_setting( 'dp_footer_text', array( 'sanitize_callback' => 'dp_sanitize_text' ) ); $wp_customize->add_control( 'dp_footer_text', array( 'label' => __( 'Footer text', 'boss' ), 'section' => 'dp_sidebar_footer_section', 'type' => 'text' ) ); function dp_sanitize_text( $input ) { return wp_kses($input, array( 'a' => array( 'href' => array(), 'class' => array(), 'id' => array(), 'title' => array() ), 'br' => array(), 'em' => array(), 'i' => array(), 'strong' => array(), 'b' => array(), 'p' => array( 'class' => array(), 'id' => array() ), 'div' => array( 'class' => array(), 'id' => array() ) )); } //footer social icons $wp_customize->add_setting( 'dp_footer_icons_behance', array( 'sanitize_callback' => 'dp_sanitize_footer_icons' ) ); $wp_customize->add_control( 'dp_footer_icons_behance', array( 'label' => __( 'Footer icons - Behance', 'boss' ), 'section' => 'dp_sidebar_footer_section', 'type' => 'text' ) ); $wp_customize->add_setting( 'dp_footer_icons_dribbble', array( 'sanitize_callback' => 'dp_sanitize_footer_icons' ) ); $wp_customize->add_control( 'dp_footer_icons_dribbble', array( 'label' => __( 'Footer icons - Dribbble', 'boss' ), 'section' => 'dp_sidebar_footer_section', 'type' => 'text' ) ); $wp_customize->add_setting( 'dp_footer_icons_facebook', array( 'sanitize_callback' => 'dp_sanitize_footer_icons' ) ); $wp_customize->add_control( 'dp_footer_icons_facebook', array( 'label' => __( 'Footer icons - Facebook', 'boss' ), 'section' => 'dp_sidebar_footer_section', 'type' => 'text' ) ); $wp_customize->add_setting( 'dp_footer_icons_gplus', array( 'sanitize_callback' => 'dp_sanitize_footer_icons' ) ); $wp_customize->add_control( 'dp_footer_icons_gplus', array( 'label' => __( 'Footer icons - Google+', 'boss' ), 'section' => 'dp_sidebar_footer_section', 'type' => 'text' ) ); $wp_customize->add_setting( 'dp_footer_icons_instagram', array( 'sanitize_callback' => 'dp_sanitize_footer_icons' ) ); $wp_customize->add_control( 'dp_footer_icons_instagram', array( 'label' => __( 'Footer icons - Instagram', 'boss' ), 'section' => 'dp_sidebar_footer_section', 'type' => 'text' ) ); $wp_customize->add_setting( 'dp_footer_icons_linkedin', array( 'sanitize_callback' => 'dp_sanitize_footer_icons' ) ); $wp_customize->add_control( 'dp_footer_icons_linkedin', array( 'label' => __( 'Footer icons - LinkedIN', 'boss' ), 'section' => 'dp_sidebar_footer_section', 'type' => 'text' ) ); $wp_customize->add_setting( 'dp_footer_icons_pinterest', array( 'sanitize_callback' => 'dp_sanitize_footer_icons' ) ); $wp_customize->add_control( 'dp_footer_icons_pinterest', array( 'label' => __( 'Footer icons - Pinterest', 'boss' ), 'section' => 'dp_sidebar_footer_section', 'type' => 'text' ) ); $wp_customize->add_setting( 'dp_footer_icons_rss', array( 'sanitize_callback' => 'dp_sanitize_footer_icons' ) ); $wp_customize->add_control( 'dp_footer_icons_rss', array( 'label' => __( 'Footer icons - RSS', 'boss' ), 'section' => 'dp_sidebar_footer_section', 'type' => 'text' ) ); $wp_customize->add_setting( 'dp_footer_icons_twitter', array( 'sanitize_callback' => 'dp_sanitize_footer_icons' ) ); $wp_customize->add_control( 'dp_footer_icons_twitter', array( 'label' => __( 'Footer icons - Twitter', 'boss' ), 'section' => 'dp_sidebar_footer_section', 'type' => 'text' ) ); $wp_customize->add_setting( 'dp_footer_icons_email', array( 'sanitize_callback' => 'dp_sanitize_footer_icons' ) ); $wp_customize->add_control( 'dp_footer_icons_email', array( 'label' => __( 'Footer icons - Email', 'boss' ), 'section' => 'dp_sidebar_footer_section', 'type' => 'text' ) ); function dp_sanitize_footer_icons( $input ) { return esc_url( $input ); } //post sharing $wp_customize->add_section( 'dp_post_sharing_section' , array( 'title' => __( 'Post Sharing', 'boss' ), 'priority' => 100, 'description' => __( 'Select which sharing icons should appear below posts!', 'boss' ) ) ); $wp_customize->add_setting( 'dp_post_sharing_facebook', array( 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'dp_post_sharing_facebook', array( 'label' => __( 'Facebook', 'boss' ), 'section' => 'dp_post_sharing_section', 'type' => 'checkbox' ) ); $wp_customize->add_setting( 'dp_post_sharing_twitter', array( 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'dp_post_sharing_twitter', array( 'label' => __( 'Twitter', 'boss' ), 'section' => 'dp_post_sharing_section', 'type' => 'checkbox' ) ); $wp_customize->add_setting( 'dp_post_sharing_gplus', array( 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'dp_post_sharing_gplus', array( 'label' => __( 'Google+', 'boss' ), 'section' => 'dp_post_sharing_section', 'type' => 'checkbox' ) ); $wp_customize->add_setting( 'dp_post_sharing_linkedin', array( 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'dp_post_sharing_linkedin', array( 'label' => __( 'LinkedIN', 'boss' ), 'section' => 'dp_post_sharing_section', 'type' => 'checkbox' ) ); $wp_customize->add_setting( 'dp_post_sharing_pinterest', array( 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'dp_post_sharing_pinterest', array( 'label' => __( 'Pinterest', 'boss' ), 'section' => 'dp_post_sharing_section', 'type' => 'checkbox' ) ); $wp_customize->add_setting( 'dp_post_sharing_reddit', array( 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'dp_post_sharing_reddit', array( 'label' => __( 'Reddit', 'boss' ), 'section' => 'dp_post_sharing_section', 'type' => 'checkbox' ) ); $wp_customize->add_setting( 'dp_post_sharing_digg', array( 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'dp_post_sharing_digg', array( 'label' => __( 'Digg', 'boss' ), 'section' => 'dp_post_sharing_section', 'type' => 'checkbox' ) ); $wp_customize->add_setting( 'dp_post_sharing_delicious', array( 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'dp_post_sharing_delicious', array( 'label' => __( 'Delicous', 'boss' ), 'section' => 'dp_post_sharing_section', 'type' => 'checkbox' ) ); $wp_customize->add_setting( 'dp_post_sharing_stumble', array( 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'dp_post_sharing_stumble', array( 'label' => __( 'StumbleUpon', 'boss' ), 'section' => 'dp_post_sharing_section', 'type' => 'checkbox' ) ); $wp_customize->add_setting( 'dp_post_sharing_tumblr', array( 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'dp_post_sharing_tumblr', array( 'label' => __( 'Tumblr', 'boss' ), 'section' => 'dp_post_sharing_section', 'type' => 'checkbox' ) ); $wp_customize->add_setting( 'dp_post_sharing_email', array( 'sanitize_callback' => 'absint' ) ); $wp_customize->add_control( 'dp_post_sharing_email', array( 'label' => __( 'Email', 'boss' ), 'section' => 'dp_post_sharing_section', 'type' => 'checkbox' ) ); } add_action( 'customize_register', 'dp_theme_customizer' ); // user can decide which post categories to load on a blog or portfolio page template if ( is_admin() ) { $dp_new_meta_boxes_blogcats = array( "sc_gen" => array( "name" => "dp_post_cats", "std" => "", "title" => "Post Categories" ) ); function dp_category_selector() { global $post; $dp_post_cats = get_post_meta($post->ID, 'dp_post_cats', true); $tax_terms = get_terms('category'); echo'

    '.__('Here you can select which post categories you\'d like to display on this page.','boss').'

     

    '; } function dp_create_meta_box_blogcats() { global $theme_name; if ( function_exists('add_meta_box') ) { add_meta_box( 'dp-category-selector', 'Post Categories', 'dp_category_selector', 'page', 'side' ); } } add_action('admin_menu', 'dp_create_meta_box_blogcats'); //save meta box values function dp_save_postdata_blogcats(){ global $post, $dp_post_cats; //save fields if(!empty($_POST['dp_post_cats'])){ update_post_meta($post->ID,'dp_post_cats',$_POST['dp_post_cats']); } } add_action('save_post', 'dp_save_postdata_blogcats'); } // user can decide which widget area should appear on a page template if(is_admin()){ $dp_new_meta_boxes_widget_areas = array( "sc_gen" => array( "name" => "dp_widget_areas", "std" => "", "title" => "Widget Areas" ) ); function dp_widget_areas() { global $post; $dp_widget_areas_sidebar = get_post_meta($post->ID, 'dp-widget-areas-sidebar', true); $dp_widget_areas_first_footer = get_post_meta($post->ID, 'dp-widget-areas-first-footer', true); $dp_widget_areas_second_footer = get_post_meta($post->ID, 'dp-widget-areas-second-footer', true); $dp_widget_areas_third_footer = get_post_meta($post->ID, 'dp-widget-areas-third-footer', true); $dp_widget_areas_fourth_footer = get_post_meta($post->ID, 'dp-widget-areas-fourth-footer', true); echo'

    '.__('Here you can select widget areas that should appear on this page.','boss').'

    '; //list widget areas echo '

    '.__('Sidebar','boss').'

    '; echo '

    '; echo '

     

    '; echo '

    '.__('Footer','boss').'

    '; echo '

    '; echo '

    '; echo '

    '; echo '

    '; echo '

     

    '; } function dp_create_meta_box_widget_areas() { global $theme_name; if ( function_exists('add_meta_box') ) { add_meta_box( 'dp-widget-areas', 'Widget Areas', 'dp_widget_areas', 'page', 'side' ); add_meta_box( 'dp-widget-areas', 'Widget Areas', 'dp_widget_areas', 'post', 'side' ); } } add_action('admin_menu', 'dp_create_meta_box_widget_areas'); //save meta box values function dp_save_postdata_widget_areas(){ global $post, $dp_widget_areas; //save fields if(!empty($_POST['dp-widget-areas-sidebar'])){ update_post_meta($post->ID,'dp-widget-areas-sidebar',$_POST['dp-widget-areas-sidebar']); }elseif(!empty($post->ID)){ delete_post_meta($post->ID,'dp-widget-areas-sidebar'); } if(!empty($_POST['dp-widget-areas-first-footer'])){ update_post_meta($post->ID,'dp-widget-areas-first-footer',$_POST['dp-widget-areas-first-footer']); }elseif(!empty($post->ID)){ delete_post_meta($post->ID,'dp-widget-areas-first-footer'); } if(!empty($_POST['dp-widget-areas-second-footer'])){ update_post_meta($post->ID,'dp-widget-areas-second-footer',$_POST['dp-widget-areas-second-footer']); }elseif(!empty($post->ID)){ delete_post_meta($post->ID,'dp-widget-areas-second-footer'); } if(!empty($_POST['dp-widget-areas-third-footer'])){ update_post_meta($post->ID,'dp-widget-areas-third-footer',$_POST['dp-widget-areas-third-footer']); }elseif(!empty($post->ID)){ delete_post_meta($post->ID,'dp-widget-areas-third-footer'); } if(!empty($_POST['dp-widget-areas-fourth-footer'])){ update_post_meta($post->ID,'dp-widget-areas-fourth-footer',$_POST['dp-widget-areas-fourth-footer']); }elseif(!empty($post->ID)){ delete_post_meta($post->ID,'dp-widget-areas-fourth-footer'); } } add_action('save_post', 'dp_save_postdata_widget_areas'); } ?>