'; } } /** Activation theme. */ function myactivationfunction($oldname, $oldtheme=false) { add_option( 'comming_soon', '' ); add_option( 'type_comming_soon', 'skin2' ); add_option( 'datatime_startsite', '' ); add_option( 'heading_text_comming_soon', 'We Are Currently Under Construction' ); add_option( 'description_text_comming_soon', 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.' ); add_option( 'default_sidebar_position_category', 'right' ); add_option( 'default_list_style_category', 'list' ); add_option( 'default_post_style_category', 'standart' ); add_option( 'default_even_animation_box', '' ); add_option( 'default_even_delay_box', '' ); add_option( 'default_odd_animation_box', '' ); add_option( 'default_odd_delay_box', '' ); add_option( 'default_date_animation_box', '' ); add_option( 'default_date_delay_box', '' ); add_option( 'default_sidebar_position_post', 'full' ); add_option( 'type_preloader', 'skin5' ); add_option( 'text_preloader', '' ); add_option( 'animation_for_logo', '' ); add_option( 'delay_for_logo', '' ); add_option( 'default_body_font', '' ); add_option( 'default_body_fontweight', '' ); add_option( 'default_body_fontstyle', '' ); add_option( 'default_body_fontsize', '' ); add_option( 'default_body_lineheight', '' ); add_option( 'default_body_letter_spacing', '' ); add_option( 'default_body_fontcolor', '' ); add_option( 'default_h1_font', '' ); add_option( 'default_h1_fontweight', '' ); add_option( 'default_h1_fontstyle', '' ); add_option( 'default_h1_fontsize', '' ); add_option( 'default_h1_lineheight', '' ); add_option( 'default_h1_letter_spacing', '' ); add_option( 'default_h1_fontcolor', '' ); add_option( 'default_h2_font', '' ); add_option( 'default_h2_fontweight', '' ); add_option( 'default_h2_fontstyle', '' ); add_option( 'default_h2_fontsize', '' ); add_option( 'default_h2_lineheight', '' ); add_option( 'default_h2_letter_spacing', '' ); add_option( 'default_h2_fontcolor', '' ); add_option( 'default_h3_font', '' ); add_option( 'default_h3_fontweight', '' ); add_option( 'default_h3_fontstyle', '' ); add_option( 'default_h3_fontsize', '' ); add_option( 'default_h3_lineheight', '' ); add_option( 'default_h3_letter_spacing', '' ); add_option( 'default_h3_fontcolor', '' ); add_option( 'default_h4_font', '' ); add_option( 'default_h4_fontweight', '' ); add_option( 'default_h4_fontstyle', '' ); add_option( 'default_h4_fontsize', '' ); add_option( 'default_h4_lineheight', '' ); add_option( 'default_h4_letter_spacing', '' ); add_option( 'default_h4_fontcolor', '' ); add_option( 'default_h5_font', '' ); add_option( 'default_h5_fontweight', '' ); add_option( 'default_h5_fontstyle', '' ); add_option( 'default_h5_fontsize', '' ); add_option( 'default_h5_lineheight', '' ); add_option( 'default_h5_letter_spacing', '' ); add_option( 'default_h5_fontcolor', '' ); add_option( 'default_h6_font', '' ); add_option( 'default_h6_fontweight', '' ); add_option( 'default_h6_fontstyle', '' ); add_option( 'default_h6_fontsize', '' ); add_option( 'default_h6_lineheight', '' ); add_option( 'default_h6_letter_spacing', '' ); add_option( 'default_h6_fontcolor', '' ); add_option( 'line_title_backcolor', '#edf1f2' ); add_option( 'line_title_textcolor', '#000000' ); add_option( 'animation_line_title', '' ); add_option( 'delay_line_title', '' ); add_option( 'show_brealcrums_line', 'show' ); add_option( 'breadcrums_a_color', '#3bc0c3' ); add_option( 'breadcrums_ahover_color', '#000000' ); add_option( 'breadcrums_ccurrent', '#9caab3' ); add_option( 'breadcrums_text', '#9caab3' ); add_option( 'show_ajax_load', '' ); add_option( 'menu_ontop_preloader', '' ); add_option( 'menu_fixed', '' ); add_option( 'animation_for_menu', '' ); add_option( 'delay_for_menu', '' ); add_option( 'menu_background', '#ffffff' ); add_option( 'menu_background_hover', '#edf1f2' ); add_option( 'menu_text_color', '#7f8f99' ); add_option( 'menu_text_color_hover', '#39c1c3' ); add_option( 'menu_text_color_current', '#7f8f99' ); add_option( 'menu_border_color_current', '#39c1c3' ); add_option( 'sub_menu_background', '#edf1f2' ); add_option( 'sub_menu_background_hover', '#39c1c3' ); add_option( 'sub_menu_text_color', '#a1b1bc' ); add_option( 'sub_menu_text_color_hover', '#ffffff' ); add_option( 'sub_menu_text_color_current', '#ffffff' ); add_option( 'sub_menu_border_color_current', '#39c1c3' ); add_option( 'menu_border_color_full', '#edf1f2' ); add_option( 'border_width_skin_1', '0' ); add_option( 'border_width_skin_2', '1' ); add_option( 'logo_vertical_padding', '18' ); add_option( 'menu_vertical_padding', '0' ); add_option( 'social_link_facebook', 'https://www.facebook.com/' ); add_option( 'social_share_facebook', 'enable' ); add_option( 'social_link_twitter', 'https://twitter.com/' ); add_option( 'social_share_twitter', 'enable' ); add_option( 'social_link_google_plus', 'https://plus.google.com/' ); add_option( 'social_share_google_plus', 'enable' ); add_option( 'social_link_vkontakte', 'http://vk.com/' ); add_option( 'social_share_vkontakte', 'enable' ); add_option( 'social_link_mailru', 'https://mail.ru/' ); add_option( 'social_share_mailru', 'enable' ); add_option( 'social_link_odnoklassniki', 'http://ok.ru/' ); add_option( 'social_share_odnoklassniki', 'enable' ); add_option( 'social_link_linkedin', 'https://www.linkedin.com/' ); add_option( 'social_share_linkedin', 'enable' ); add_option( 'social_link_livejournal', 'http://www.livejournal.com/' ); add_option( 'social_share_livejournal', 'enable' ); add_option( 'social_link_tumblr', 'https://www.tumblr.com/' ); add_option( 'social_share_tumblr', 'enable' ); add_option( 'show_header_first', 'Yes' ); add_option( 'top_sdb_background', '#edf1f2' ); add_option( 'top_txt_color', '#677b87' ); add_option( 'logo_sdb_padding', '10' ); add_option( 'logo_header_position', 'skin1' ); add_option( 'show_header_login', '1' ); add_option( 'footer_copyright', '© Copyright 2015' ); add_option( 'footer_backgroung', '#b6c2c9' ); add_option( 'footer_text_color', '#ffffff' ); add_option( 'fwidgeteria_background', '#edf1f2' ); add_option( 'fwidgeteria_color_text', '#888888' ); add_option( 'fwidgeteria_color_links', '#141414' ); add_option( 'fwidgeteria_color_h3', '#8698a2' ); add_option( 'fwidgeteria_color_h4', '#000000' ); add_option( 'logo_noimage_color', '#3BC0C3' ); add_option( 'logo_noimage_size', '18' ); add_option( 'slogan_noimage_color', '#989898' ); add_option( 'slogan_noimage_size', '18' ); add_option( 'logo_noimage_2row', '2row' ); add_option( 'show_border_menu', 'yes' ); add_option( 'type_contact', 'skin1' ); //update_option( 'page_on_front', '10' ); //update_option( 'show_on_front', 'page' ); //add_option( 'line_title_image', '1740' ); //add_option( 'favicon_theme', '767' ); //add_option( 'logo_in_header', '64' ); //add_option( 'logo_in_footer', '272' ); //add_option( 'logo_big_size', '1339' ); //add_option( 'logo_preloader', '229' ); //add_option( 'background_preloader', '1143' ); //add_option( 'category_2', 'a:4:{s:9:"cat_title";s:1:"1";s:9:"list_grid";s:4:"list";s:12:"post_masonry";s:8:"standart";s:16:"sidebar_position";s:4:"left";}' ); //add_option( 'category_3', 'a:3:{s:16:"sidebar_position";s:4:"full";s:9:"list_grid";s:4:"grid";s:12:"post_masonry";s:8:"standart";}' ); //add_option( 'category_5', 'a:3:{s:16:"sidebar_position";s:5:"right";s:9:"list_grid";s:4:"list";s:12:"post_masonry";s:8:"standart";}' ); //add_option( 'category_19', 'a:3:{s:16:"sidebar_position";s:5:"right";s:9:"list_grid";s:4:"grid";s:12:"post_masonry";s:8:"standart";}' ); //add_option( 'category_21', 'a:11:{s:16:"sidebar_position";s:4:"full";s:9:"list_grid";s:8:"timeline";s:12:"post_masonry";s:8:"standart";s:13:"animation_box";s:10:"fadeInLeft";s:9:"delay_box";s:10:"delay-0_5s";s:18:"even_animation_box";s:0:"";s:14:"even_delay_box";s:10:"delay-0_5s";s:17:"odd_animation_box";s:0:"";s:13:"odd_delay_box";s:10:"delay-0_5s";s:18:"date_animation_box";s:0:"";s:14:"date_delay_box";s:10:"delay-1_0s";}' ); //add_option( 'category_22', 'a:9:{s:16:"sidebar_position";s:4:"left";s:9:"list_grid";s:8:"timeline";s:12:"post_masonry";s:8:"standart";s:18:"even_animation_box";s:0:"";s:14:"even_delay_box";s:0:"";s:17:"odd_animation_box";s:0:"";s:13:"odd_delay_box";s:0:"";s:18:"date_animation_box";s:0:"";s:14:"date_delay_box";s:0:"";}' ); //add_option( 'category_23', 'a:3:{s:16:"sidebar_position";s:5:"right";s:9:"list_grid";s:8:"timeline";s:12:"post_masonry";s:7:"masonry";}' ); //add_option( 'category_6', 'a:3:{s:16:"sidebar_position";s:4:"full";s:9:"list_grid";s:4:"list";s:12:"post_masonry";s:8:"standart";}' ); //add_option( 'category_18', 'a:5:{s:16:"sidebar_position";s:4:"left";s:9:"list_grid";s:4:"grid";s:12:"post_masonry";s:8:"standart";s:13:"animation_box";s:0:"";s:9:"delay_box";s:0:"";}' ); } add_action("after_switch_theme", "myactivationfunction", 10 , 2); /** Deactivation theme. */ function mydeactivationfunction($newname, $newtheme) { /* delete_option( 'comming_soon' ); delete_option( 'type_comming_soon' ); delete_option( 'datatime_startsite' ); delete_option( 'heading_text_comming_soon' ); delete_option( 'description_text_comming_soon' ); delete_option( 'default_sidebar_position_category' ); delete_option( 'default_list_style_category' ); delete_option( 'default_post_style_category' ); delete_option( 'default_even_animation_box' ); delete_option( 'default_even_delay_box' ); delete_option( 'default_odd_animation_box' ); delete_option( 'default_odd_delay_box' ); delete_option( 'default_date_animation_box' ); delete_option( 'default_date_delay_box' ); delete_option( 'default_sidebar_position_post' ); delete_option( 'type_preloader' ); delete_option( 'text_preloader' ); delete_option( 'animation_for_logo' ); delete_option( 'delay_for_logo' ); delete_option( 'default_body_font'); delete_option( 'default_body_fontweight' ); delete_option( 'default_body_fontstyle' ); delete_option( 'default_body_fontsize' ); delete_option( 'default_body_lineheight' ); delete_option( 'default_body_letter_spacing' ); delete_option( 'default_body_fontcolor' ); delete_option( 'default_h1_font' ); delete_option( 'default_h1_fontweight' ); delete_option( 'default_h1_fontstyle' ); delete_option( 'default_h1_fontsize' ); delete_option( 'default_h1_lineheight' ); delete_option( 'default_h1_letter_spacing' ); delete_option( 'default_h1_fontcolor' ); delete_option( 'default_h2_font' ); delete_option( 'default_h2_fontweight' ); delete_option( 'default_h2_fontstyle' ); delete_option( 'default_h2_fontsize' ); delete_option( 'default_h2_lineheight' ); delete_option( 'default_h2_letter_spacing' ); delete_option( 'default_h2_fontcolor' ); delete_option( 'default_h3_font' ); delete_option( 'default_h3_fontweight' ); delete_option( 'default_h3_fontstyle' ); delete_option( 'default_h3_fontsize' ); delete_option( 'default_h3_lineheight' ); delete_option( 'default_h3_letter_spacing' ); delete_option( 'default_h3_fontcolor' ); delete_option( 'default_h4_font' ); delete_option( 'default_h4_fontweight' ); delete_option( 'default_h4_fontstyle' ); delete_option( 'default_h4_fontsize' ); delete_option( 'default_h4_lineheight' ); delete_option( 'default_h4_letter_spacing' ); delete_option( 'default_h4_fontcolor' ); delete_option( 'default_h5_font' ); delete_option( 'default_h5_fontweight' ); delete_option( 'default_h5_fontstyle' ); delete_option( 'default_h5_fontsize' ); delete_option( 'default_h5_lineheight' ); delete_option( 'default_h5_letter_spacing' ); delete_option( 'default_h5_fontcolor' ); delete_option( 'default_h6_font' ); delete_option( 'default_h6_fontweight' ); delete_option( 'default_h6_fontstyle' ); delete_option( 'default_h6_fontsize' ); delete_option( 'default_h6_lineheight' ); delete_option( 'default_h6_letter_spacing' ); delete_option( 'default_h6_fontcolor' ); delete_option( 'line_title_backcolor' ); delete_option( 'line_title_textcolor' ); delete_option( 'animation_line_title' ); delete_option( 'delay_line_title' ); delete_option( 'show_brealcrums_line' ); delete_option( 'breadcrums_a_color' ); delete_option( 'breadcrums_ahover_color' ); delete_option( 'breadcrums_ccurrent' ); delete_option( 'breadcrums_text' ); delete_option( 'show_ajax_load' ); delete_option( 'menu_ontop_preloader' ); delete_option( 'menu_fixed' ); delete_option( 'animation_for_menu' ); delete_option( 'delay_for_menu' ); delete_option( 'menu_background' ); delete_option( 'menu_background_hover' ); delete_option( 'menu_text_color' ); delete_option( 'menu_text_color_hover' ); delete_option( 'menu_text_color_current' ); delete_option( 'menu_border_color_current' ); delete_option( 'sub_menu_background' ); delete_option( 'sub_menu_background_hover' ); delete_option( 'sub_menu_text_color' ); delete_option( 'sub_menu_text_color_hover' ); delete_option( 'sub_menu_text_color_current' ); delete_option( 'sub_menu_border_color_current' ); delete_option( 'menu_border_color_full' ); delete_option( 'border_width_skin_1' ); delete_option( 'border_width_skin_2' ); delete_option( 'logo_vertical_padding' ); delete_option( 'menu_vertical_padding' ); delete_option( 'social_link_facebook' ); delete_option( 'social_share_facebook' ); delete_option( 'social_link_twitter' ); delete_option( 'social_share_twitter' ); delete_option( 'social_link_google_plus' ); delete_option( 'social_share_google_plus' ); delete_option( 'social_link_vkontakte' ); delete_option( 'social_share_vkontakte' ); delete_option( 'social_link_mailru' ); delete_option( 'social_share_mailru' ); delete_option( 'social_link_odnoklassniki' ); delete_option( 'social_share_odnoklassniki' ); delete_option( 'social_link_linkedin' ); delete_option( 'social_share_linkedin' ); delete_option( 'social_link_livejournal' ); delete_option( 'social_share_livejournal' ); delete_option( 'social_link_tumblr' ); delete_option( 'social_share_tumblr' ); delete_option( 'show_header_first' ); delete_option( 'top_sdb_background' ); delete_option( 'top_txt_color' ); delete_option( 'logo_sdb_padding' ); delete_option( 'logo_header_position' ); delete_option( 'show_header_login' ); delete_option( 'footer_copyright' ); delete_option( 'footer_backgroung' ); delete_option( 'footer_text_color' ); delete_option( 'fwidgeteria_background' ); delete_option( 'fwidgeteria_color_text' ); delete_option( 'fwidgeteria_color_links' ); delete_option( 'fwidgeteria_color_h3' ); delete_option( 'fwidgeteria_color_h4' ); delete_option( 'line_title_image' ); delete_option( 'favicon_theme' ); delete_option( 'logo_in_header' ); delete_option( 'logo_in_footer' ); delete_option( 'logo_big_size' ); delete_option( 'logo_preloader' ); delete_option( 'background_preloader' ); delete_option( 'logo_noimage_color'); delete_option( 'logo_noimage_size'); delete_option( 'slogan_noimage_color'); delete_option( 'slogan_noimage_size'); delete_option( 'logo_noimage_2row'); delete_option( 'show_border_menu'); delete_option( 'type_contact'); */ } add_action("switch_theme", "mydeactivationfunction", 10 , 2); add_action('init', 'register_nav_menus_on_init'); function register_nav_menus_on_init() { register_nav_menus(array( 'top-pages-menu' => 'My Top Pages Menu', )); } /** Import demo data theme. */ //include_once('includes/import/custom-import.php'); /** Support Formats theme. */ /* add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery', ) ); */ /** Support post-thumbnails */ if ( function_exists( 'add_theme_support' ) ) { add_theme_support( 'post-thumbnails' ); } add_theme_support( 'automatic-feed-links' ); add_theme_support( "title-tag" ); add_theme_support( "custom-header"); add_theme_support( "custom-background" ); if ( ! isset( $content_width ) ) { $content_width = 600; } /** Include VARS from theme. */ include_once('includes/vars.php'); /** Add Support WooCommerce. */ //add_theme_support( 'woocommerce' ); /** Include the TGM_Plugin_Activation class. */ //include_once('includes/plugins/requared-plugin-list.php'); composer /** Include Custom Options for This Theme */ include_once('includes/admin/theme-options.php'); /** Include Custom Options for This Theme */ include_once('includes/admin/metaboxes.php'); include_once('includes/admin/custom-fields-post-formats.php'); /** Include Custom Widgets and Shortcodes for This Theme */ include_once('includes/admin/widgets.php'); /** Register custom sidebar */ /* if ( function_exists('register_sidebar') ) register_sidebar(array( 'before_widget' => '
', 'id' => 'sidebar', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); */ function register_my_widgets(){ register_sidebar( array( 'name' => "Blog Sidebar", 'id' => 'blog-sidebar', 'description' => '', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'before_widget' => '
', 'after_widget' => '
', 'name' => "Pages Sidebar", 'id' => 'pages-sidebar', 'description' => '', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => "Top panel Left", 'id' => 'top-sidebar', 'description' => 'Telephone and Adress', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => "Top panel Right", 'id' => 'top-sidebar-right', 'description' => 'Logins, social...', 'before_title' => '', 'after_title' => '' ) ); register_sidebar( array( 'name' => "Footer Colum 1", 'id' => 'footer-colum-1', 'description' => '', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => "Footer Colum 2", 'id' => 'footer-colum-2', 'description' => '', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => "Footer Colum 3", 'id' => 'footer-colum-3', 'description' => '', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => "Footer Colum 4", 'id' => 'footer-colum-4', 'description' => '', 'before_title' => '

', 'after_title' => '

' ) ); } add_action( 'widgets_init', 'register_my_widgets' ); /** Include Custom Template and setting Visual Composer */ function your_name_integrateWithVC() { require_once locate_template('/vc_extend/vc_extend.php'); } add_action( 'vc_before_init', 'your_name_integrateWithVC' ); /** Include CSS framework */ function social_share() { wp_enqueue_script( 'social-share', esc_url( get_template_directory_uri() ) . '/js/social_share.js', false, '1.0'); } add_action( 'wp_enqueue_scripts', 'social_share' ); /** Include Cliker Action and Hook */ function clicker_action() { wp_enqueue_script( 'clicker-action', esc_url( get_template_directory_uri() ) . '/js/clicker_action.js', false, '1.0'); } add_action( 'wp_enqueue_scripts', 'clicker_action' ); /** Include Slider Class */ function slider_class() { wp_enqueue_script( 'slider-class', esc_url( get_template_directory_uri() ) . '/js/jquery.glide.js', false, '1.0'); } add_action( 'wp_enqueue_scripts', 'slider_class' ); /** Include CSS framework */ function animation_styles() { wp_enqueue_style( 'animation-styles', esc_url( get_template_directory_uri() ).'/css/animate.css', false, '1.0', 'all'); wp_enqueue_script( 'animation-styles', esc_url( get_template_directory_uri() ) . '/js/jquery.inview.js', false, '1.0'); } add_action( 'wp_enqueue_scripts', 'animation_styles' ); /** Include CSS Font Avesome */ function animation_avesome() { wp_enqueue_style( 'animation-avesome', esc_url( get_template_directory_uri() ).'/css/font-awesome/css/font-awesome.min.css', false, '1.0', 'all'); } add_action( 'wp_enqueue_scripts', 'animation_avesome' ); /** Include custom Fonts*/ function custom_fontes() { wp_enqueue_style( 'custom_fontes', esc_url( get_template_directory_uri() ).'/css/geometric-figure/style.css', false, '1.0', 'all'); wp_enqueue_script( 'custom_fontes', esc_url( get_template_directory_uri() ) . '/js/mobile.menu.js', false, '1.0'); } add_action( 'wp_enqueue_scripts', 'custom_fontes' ); /** Include Upload Image n options */ function true_include_myuploadscript() { if ( ! did_action( 'wp_enqueue_media' ) ) { wp_enqueue_media(); } } add_action( 'admin_enqueue_scripts', 'true_include_myuploadscript' ); function true_image_uploader_field( $name, $value = '', $w = 100, $h = 100) { $default = get_stylesheet_directory_uri() . '/img/no_img.png'; if( $value ) { $image_attributes = wp_get_attachment_image_src( $value, 'full' ); $src = $image_attributes[0]; } else { $src = $default; } echo '

'; } //Builder animation data function data_animate($animation_style, $animation_delay, $default_animaton_box) { if ($animation_style == '') { if ($default_animaton_box == 'date_box') { $animation_style = get_option( 'default_date_animation_box' ); } if ($default_animaton_box == 'odd_post_box') { $animation_style = get_option( 'default_odd_animation_box' ); } if ($default_animaton_box == 'even_post_box') { $animation_style = get_option( 'default_even_animation_box' ); } } if ($animation_delay == '') { if ($default_animaton_box == 'date_box') { $animation_delay = get_option( 'default_date_delay_box' ); } if ($default_animaton_box == 'odd_post_box') { $animation_delay = get_option( 'default_odd_delay_box' ); } if ($default_animaton_box == 'even_post_box') { $animation_delay = get_option( 'default_even_delay_box' ); } } if ($animation_style != '') { echo 'data-animate="'.$animation_style.' '.$animation_delay.' animated"';} } //Builder class search animation function animation_screen($animation_style, $in_class, $default_animaton_box) { if ($animation_style == '') { if ($default_animaton_box == 'date_box') { $animation_style = get_option( 'default_date_animation_box' ); } if ($default_animaton_box == 'odd_post_box') { $animation_style = get_option( 'default_odd_animation_box' ); } if ($default_animaton_box == 'even_post_box') { $animation_style = get_option( 'default_even_animation_box' ); } } if ($in_class == true) { if ($animation_style != '') {echo 'animation-screen';} } else { if ($animation_style != '') {echo 'class="animation-screen"';} } } //Builder option select list function option_builder($option_list, $selected_element) { $i=0; foreach ($option_list as $key => $value) { if ( $selected_element == $value ) { $selected = 'selected="selected"'; } else { $selected = ''; } $output .= ''; } return $output; } //--------------------------- //Add All ShortCode //--------------------------- if ($handle = opendir(plugin_dir_path( __FILE__ ) . "includes/shortcode")) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { include_once("includes/shortcode/$file"); } } closedir($handle); } //--------------------------- //Add All Metaboxes //--------------------------- if ($handle = opendir(plugin_dir_path( __FILE__ ) . "includes/metaboxes")) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { include_once("includes/metaboxes/$file"); } } closedir($handle); } //--------------------------- //Add Post Type Pages //--------------------------- if ($handle = opendir(plugin_dir_path( __FILE__ ) . "includes/post_type")) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { include_once("includes/post_type/$file"); } } closedir($handle); } //--------------------------- //Custom taxonomy //--------------------------- function register_taxonomy2( $taxonomy, $object_type, $args = array() ) { global $wp_taxonomies, $wp; if ( ! is_array( $wp_taxonomies ) ) $wp_taxonomies = array(); $defaults = array( 'labels' => array(), 'description' => '', 'public' => true, 'hierarchical' => false, 'show_ui' => null, 'show_in_menu' => null, 'show_in_nav_menus' => null, 'show_tagcloud' => null, 'show_in_quick_edit' => null, 'show_admin_column' => false, 'meta_box_cb' => null, 'capabilities' => array(), 'rewrite' => true, 'query_var' => $taxonomy, 'update_count_callback' => '', '_builtin' => false, ); $args = wp_parse_args( $args, $defaults ); if ( empty( $taxonomy ) || strlen( $taxonomy ) > 32 ) { _doing_it_wrong( __FUNCTION__, 'Taxonomy names must be between 1 and 32 characters in length.', '4.2' ); return new WP_Error( 'taxonomy_length_invalid', 'Taxonomy names must be between 1 and 32 characters in length.' ); } if ( false !== $args['query_var'] && ! empty( $wp ) ) { if ( true === $args['query_var'] ) $args['query_var'] = $taxonomy; else $args['query_var'] = sanitize_title_with_dashes( $args['query_var'] ); $wp->add_query_var( $args['query_var'] ); } if ( false !== $args['rewrite'] && ( is_admin() || '' != get_option( 'permalink_structure' ) ) ) { $args['rewrite'] = wp_parse_args( $args['rewrite'], array( 'with_front' => true, 'hierarchical' => false, 'ep_mask' => EP_NONE, ) ); if ( empty( $args['rewrite']['slug'] ) ) $args['rewrite']['slug'] = sanitize_title_with_dashes( $taxonomy ); if ( $args['hierarchical'] && $args['rewrite']['hierarchical'] ) $tag = '(.+?)'; else $tag = '([^/]+)'; add_rewrite_tag( "%$taxonomy%", $tag, $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=" ); add_permastruct( $taxonomy, "{$args['rewrite']['slug']}/%$taxonomy%", $args['rewrite'] ); } // If not set, default to the setting for public. if ( null === $args['show_ui'] ) $args['show_ui'] = $args['public']; // If not set, default to the setting for show_ui. if ( null === $args['show_in_menu' ] || ! $args['show_ui'] ) $args['show_in_menu' ] = $args['show_ui']; // If not set, default to the setting for public. if ( null === $args['show_in_nav_menus'] ) $args['show_in_nav_menus'] = $args['public']; // If not set, default to the setting for show_ui. if ( null === $args['show_tagcloud'] ) $args['show_tagcloud'] = $args['show_ui']; // If not set, default to the setting for show_ui. if ( null === $args['show_in_quick_edit'] ) { $args['show_in_quick_edit'] = $args['show_ui']; } $default_caps = array( 'manage_terms' => 'manage_categories', 'edit_terms' => 'manage_categories', 'delete_terms' => 'manage_categories', 'assign_terms' => 'edit_posts', ); $args['cap'] = (object) array_merge( $default_caps, $args['capabilities'] ); unset( $args['capabilities'] ); $args['name'] = $taxonomy; $args['object_type'] = array_unique( (array) $object_type ); $args['labels'] = get_taxonomy_labels( (object) $args ); $args['label'] = $args['labels']->name; // If not set, use the default meta box if ( null === $args['meta_box_cb'] ) { if ( $args['hierarchical'] ) $args['meta_box_cb'] = 'post_categories_meta_box'; else $args['meta_box_cb'] = 'post_tags_meta_box'; } $wp_taxonomies[ $taxonomy ] = (object) $args; // register callback handling for metabox add_filter( 'wp_ajax_add-' . $taxonomy, '_wp_ajax_add_hierarchical_term' ); /** * Fires after a taxonomy is registered. * * @since 3.3.0 * * @param string $taxonomy Taxonomy slug. * @param array|string $object_type Object type or array of object types. * @param array $args Array of taxonomy registration arguments. */ do_action( 'registered_taxonomy', $taxonomy, $object_type, $args ); } //--------------------------- //Custom post type //--------------------------- function register_post_type2( $post_type, $args = array() ) { global $wp_post_types, $wp_rewrite, $wp; if ( ! is_array( $wp_post_types ) ) $wp_post_types = array(); // Args prefixed with an underscore are reserved for internal use. $defaults = array( 'labels' => array(), 'description' => '', 'public' => false, 'hierarchical' => false, 'exclude_from_search' => null, 'publicly_queryable' => null, 'show_ui' => null, 'show_in_menu' => null, 'show_in_nav_menus' => null, 'show_in_admin_bar' => null, 'menu_position' => null, 'menu_icon' => null, 'capability_type' => 'post', 'capabilities' => array(), 'map_meta_cap' => null, 'supports' => array(), 'register_meta_box_cb' => null, 'taxonomies' => array(), 'has_archive' => false, 'rewrite' => true, 'query_var' => true, 'can_export' => true, 'delete_with_user' => null, '_builtin' => false, '_edit_link' => 'post.php?post=%d', ); $args = wp_parse_args( $args, $defaults ); $args = (object) $args; $post_type = sanitize_key( $post_type ); $args->name = $post_type; if ( empty( $post_type ) || strlen( $post_type ) > 20 ) { _doing_it_wrong( __FUNCTION__, 'Post type names must be between 1 and 20 characters in length.', '4.2' ); return new WP_Error( 'post_type_length_invalid', 'Post type names must be between 1 and 20 characters in length.' ); } // If not set, default to the setting for public. if ( null === $args->publicly_queryable ) $args->publicly_queryable = $args->public; // If not set, default to the setting for public. if ( null === $args->show_ui ) $args->show_ui = $args->public; // If not set, default to the setting for show_ui. if ( null === $args->show_in_menu || ! $args->show_ui ) $args->show_in_menu = $args->show_ui; // If not set, default to the whether the full UI is shown. if ( null === $args->show_in_admin_bar ) $args->show_in_admin_bar = (bool) $args->show_in_menu; // If not set, default to the setting for public. if ( null === $args->show_in_nav_menus ) $args->show_in_nav_menus = $args->public; // If not set, default to true if not public, false if public. if ( null === $args->exclude_from_search ) $args->exclude_from_search = !$args->public; // Back compat with quirky handling in version 3.0. #14122. if ( empty( $args->capabilities ) && null === $args->map_meta_cap && in_array( $args->capability_type, array( 'post', 'page' ) ) ) $args->map_meta_cap = true; // If not set, default to false. if ( null === $args->map_meta_cap ) $args->map_meta_cap = false; $args->cap = get_post_type_capabilities( $args ); unset( $args->capabilities ); if ( is_array( $args->capability_type ) ) $args->capability_type = $args->capability_type[0]; if ( ! empty( $args->supports ) ) { add_post_type_support( $post_type, $args->supports ); unset( $args->supports ); } elseif ( false !== $args->supports ) { // Add default features add_post_type_support( $post_type, array( 'title', 'editor' ) ); } if ( false !== $args->query_var && ! empty( $wp ) ) { if ( true === $args->query_var ) $args->query_var = $post_type; else $args->query_var = sanitize_title_with_dashes( $args->query_var ); $wp->add_query_var( $args->query_var ); } if ( false !== $args->rewrite && ( is_admin() || '' != get_option( 'permalink_structure' ) ) ) { if ( ! is_array( $args->rewrite ) ) $args->rewrite = array(); if ( empty( $args->rewrite['slug'] ) ) $args->rewrite['slug'] = $post_type; if ( ! isset( $args->rewrite['with_front'] ) ) $args->rewrite['with_front'] = true; if ( ! isset( $args->rewrite['pages'] ) ) $args->rewrite['pages'] = true; if ( ! isset( $args->rewrite['feeds'] ) || ! $args->has_archive ) $args->rewrite['feeds'] = (bool) $args->has_archive; if ( ! isset( $args->rewrite['ep_mask'] ) ) { if ( isset( $args->permalink_epmask ) ) $args->rewrite['ep_mask'] = $args->permalink_epmask; else $args->rewrite['ep_mask'] = EP_PERMALINK; } if ( $args->hierarchical ) add_rewrite_tag( "%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&pagename=" ); else add_rewrite_tag( "%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=" ); if ( $args->has_archive ) { $archive_slug = $args->has_archive === true ? $args->rewrite['slug'] : $args->has_archive; if ( $args->rewrite['with_front'] ) $archive_slug = substr( $wp_rewrite->front, 1 ) . $archive_slug; else $archive_slug = $wp_rewrite->root . $archive_slug; add_rewrite_rule( "{$archive_slug}/?$", "index.php?post_type=$post_type", 'top' ); if ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) { $feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')'; add_rewrite_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' ); add_rewrite_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' ); } if ( $args->rewrite['pages'] ) add_rewrite_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' ); } $permastruct_args = $args->rewrite; $permastruct_args['feed'] = $permastruct_args['feeds']; add_permastruct( $post_type, "{$args->rewrite['slug']}/%$post_type%", $permastruct_args ); } // Register the post type meta box if a custom callback was specified. if ( $args->register_meta_box_cb ) add_action( 'add_meta_boxes_' . $post_type, $args->register_meta_box_cb, 10, 1 ); $args->labels = get_post_type_labels( $args ); $args->label = $args->labels->name; $wp_post_types[ $post_type ] = $args; add_action( 'future_' . $post_type, '_future_post_hook', 5, 2 ); foreach ( $args->taxonomies as $taxonomy ) { register_taxonomy_for_object_type( $taxonomy, $post_type ); } /** * Fires after a post type is registered. * * @since 3.3.0 * * @param string $post_type Post type. * @param object $args Arguments used to register the post type. */ do_action( 'registered_post_type', $post_type, $args ); return $args; } //--------------------------- //Custom shortcode //--------------------------- function add_myshortcode2($tag, $func) { global $shortcode_tags; $shortcode_tags[ $tag ] = $func; }