tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /** Support Formats theme. */ /* add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery', ) ); */ /* May delete below 4 lines /** Support post-thumbnails */ /*if ( function_exists( 'add_theme_support' ) ) { add_theme_support( 'post-thumbnails' ); }*/ /* * Enable support for Post Thumbnails on posts and pages. * * See: https://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails */ add_theme_support( 'post-thumbnails' ); // Add default posts and comments RSS feed links to head. add_theme_support( 'automatic-feed-links' ); add_theme_support( "custom-header"); // Setup the WordPress core custom background feature. add_theme_support( "custom-background" ); /** Add Support WooCommerce. */ //add_theme_support( 'woocommerce' ); } endif; // alphabet_setup add_action( 'after_setup_theme', 'alphabet_setup' ); /** * Need check correct serialized data in get_option( 'theme_mods_' . get_stylesheet() ) */ /* if (!get_option('theme_mods_alphabet')) { // it is possible that something is wrong with the serialized data in wp_options.theme_mods_alphabet print '

It is possible that something is wrong with the serialized data in DB: \'wp_options.theme_mods_alphabet\'.

'; print '

File: '. __FILE__ .'

'; print '

Line: '. __LINE__ .'

'; } */ /** * * @param type $id * @return type */ function alphabet_get_the_portfolio_category( $id = false ) { $categories = get_the_terms( $id, 'portfolio_category' ); if ( ! $categories || is_wp_error( $categories ) ) $categories = array(); $categories = array_values( $categories ); foreach ( array_keys( $categories ) as $key ) { _make_cat_compat( $categories[$key] ); } /** * Filter the array of categories to return for a post. * * @since 3.1.0 * * @param array $categories An array of categories to return for the post. */ return apply_filters( 'get_the_categories', $categories ); } function alphabet_the_breadcrumb() { if ((get_option( 'show_brealcrums_line' ) == 'show') and (get_post_meta(get_the_ID(), 'brescrumbs_show', true) != 'no')) { echo ''; } } /** Activation theme. */ function alphabet_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', '' ); // in TO: select; moved add_option( 'delay_for_logo', '' ); // in TO: select; moved add_option( 'default_body_font', '' ); // in TO: select; moved add_option( 'default_body_fontweight', '' ); // in TO: select; moved add_option( 'default_body_fontstyle', '' ); // in TO: select; moved add_option( 'default_body_fontsize', '' ); // moved add_option( 'default_body_lineheight', '' ); // moved add_option( 'default_body_letter_spacing', '' ); // moved add_option( 'default_body_fontcolor', '' ); // moved add_option( 'default_h1_font', '' ); // moved 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', '' ); // moved add_option( 'default_h2_font', '' ); // moved 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', '' ); // moved add_option( 'default_h3_font', '' ); // moved 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', '' ); // moved add_option( 'default_h4_font', '' ); // moved 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', '' ); // moved add_option( 'default_h5_font', '' ); // moved 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', '' ); // moved add_option( 'default_h6_font', '' ); // moved 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', '' ); // moved add_option( 'line_title_backcolor', '#edf1f2' ); // not implemented by Theme Options (in styles) add_option( 'line_title_textcolor', '#000000' ); // not implemented by Theme Options (in styles) add_option( 'animation_line_title', '' ); // moved to Customizer add_option( 'delay_line_title', '' ); // moved to Customizer add_option( 'show_brealcrums_line', 'show' ); // moved to Customizer add_option( 'breadcrums_a_color', '#3bc0c3' ); // moved to Customizer add_option( 'breadcrums_ahover_color', '#000000' ); // moved to Customizer add_option( 'breadcrums_ccurrent', '#9caab3' ); // moved to Customizer add_option( 'breadcrums_text', '#9caab3' ); // moved to Customizer add_option( 'animation_breadcrumbs', '' ); // only in Customizer add_option( 'delay_breadcrumbs', '' ); // only in Customizer //add_option( 'show_ajax_load', '' ); // moved to Customizer; moved to serialized in DB: alphabet_theme_options; may remove //add_option( 'menu_ontop_preloader', '' ); // moved to Customizer; moved to serialized in DB: alphabet_theme_options; may remove //add_option( 'menu_fixed', '' ); // moved to Customizer; moved to serialized in DB: alphabet_theme_options; may remove add_option( 'animation_for_menu', '' ); // in TO: select; moved to Customizer add_option( 'delay_for_menu', '' ); // in TO: select; moved to Customizer add_option( 'menu_background', '#ffffff' ); // moved to Customizer add_option( 'menu_background_hover', '#edf1f2' ); // moved to Cus add_option( 'menu_text_color', '#7f8f99' ); // moved to Cus add_option( 'menu_text_color_hover', '#39c1c3' ); // moved to Cus add_option( 'menu_text_color_current', '#7f8f99' ); // moved to Cus add_option( 'menu_border_color_current', '#39c1c3' ); // moved to Cus add_option( 'sub_menu_background', '#edf1f2' ); // moved to Cus add_option( 'sub_menu_background_hover', '#39c1c3' ); // moved to Cus add_option( 'sub_menu_text_color', '#a1b1bc' ); // moved to Cus add_option( 'sub_menu_text_color_hover', '#ffffff' ); // moved to Cus add_option( 'sub_menu_text_color_current', '#ffffff' ); // moved to Cus add_option( 'sub_menu_border_color_current', '#39c1c3' ); // moved to Cus add_option( 'menu_border_color_full', '#edf1f2' ); // moved to Cus add_option( 'border_width_skin_1', '0' ); // in TO: text; moved to Cus add_option( 'border_width_skin_2', '1' ); // in TO: text; moved to Cus add_option( 'logo_vertical_padding', '18' ); // in TO: text; moved to Cus add_option( 'menu_vertical_padding', '0' ); // in TO: text; moved to Cus 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( 'logo_header_position', 'skin1' ); // moved to Customizer //add_option( 'show_header_login', '1' ); // moved to Customizer //add_option( 'show_header_first', 'Yes' ); // moved to Customizer /** set array of default options * (couse we need in options, stored as boolean values) */ $alphabet_theme_options = array( 'checkbox_show_header_login' => TRUE, 'checkbox_show_header_first' => TRUE, 'checkbox_show_ajax_load' => FALSE, 'checkbox_menu_ontop_preloader' => FALSE, 'checkbox_menu_fixed' => FALSE, 'checkbox_show_border_menu' => TRUE, ); add_option('alphabet_theme_options', $alphabet_theme_options); add_option( 'top_sdb_background', '#edf1f2' ); // moved to Customizer add_option( 'top_txt_color', '#677b87' ); // moved to Customizer add_option( 'logo_sdb_padding', '10' ); // moved to Customizer //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' ); // moved to Customizer //add_option( 'show_logo_and_text', 'show' ); // in TO: checkbox; enable core feature in Customizer; may delete from here. //add_option( 'logo_noimage_color', '#3BC0C3' ); // moved; we will use WP buit-in feature for that: theme_mod: 'header_textcolor', may delete add_option( 'logo_noimage_size', '18' ); // moved add_option( 'slogan_noimage_color', '#989898' ); // moved add_option( 'slogan_noimage_size', '18' ); // moved add_option( 'logo_noimage_2row', '2row' ); // in TO: radio; moved add_option( 'show_border_menu', 'yes' ); // checkbox in TO, moved to Customize: in proc ?? add_option( 'type_contact', 'skin1' ); //update_option( 'page_on_front', '10' ); //update_option( 'show_on_front', 'page' ); //add_option( 'line_title_image', '1740' ); // old variant //add_option( 'favicon_theme', '346' ); // was'767' // in TO: value="346" (id of image in DB (Table: wp_postmeta: _wp_attached_file: '2016/01/favicon.png')); //add_option( 'favicon_theme', '/wp-content/themes/alphabet/img/favicon.png' ); // moved; we will use wp default feature. May remove. // new variant // set default value to WP buil-in favicon add_option( 'site_icon', get_stylesheet_directory_uri() . '/img/favicon.png' ); // this is WP built-in option, pls don't make 'delete_option' action! //add_option( 'logo_in_header', '64' ); // old, was commented. (in DB: 339; image with this id: /wp-content/uploads/2016/01/logo.png) add_option( 'logo_in_header', '/wp-content/themes/alphabet/img/logo.png' ); // moved //add_option( 'logo_in_footer', '272' ); // old, was commented. (in DB: 349; image with this id: /wp-content/uploads/2016/01/logo_white.png) add_option( 'logo_in_footer', '/wp-content/themes/alphabet/img/logo_white.png' ); // moved //add_option( 'logo_big_size', '1339' ); // old, was commented. (in DB: 347; image with this id: /wp-content/uploads/2016/01/logo_big.png) add_option( 'logo_big_size', '/wp-content/themes/alphabet/img/logo_big.png' ); // moved add_option('hidden_current_option', '#custom-option-faqs'); // default Tab in TO //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", "alphabet_myactivationfunction", 10 , 2); // Temporary DUPLICATE here $alphabet_theme_options = array( 'checkbox_show_header_login' => TRUE, 'checkbox_show_header_first' => TRUE, 'checkbox_show_ajax_load' => FALSE, 'checkbox_menu_ontop_preloader' => FALSE, 'checkbox_menu_fixed' => FALSE, 'checkbox_show_border_menu' => TRUE, ); //add_option('alphabet_theme_options', $alphabet_theme_options); // Temporary DUPLICATE here add_option( 'animation_breadcrumbs', '' ); // only in Customizer add_option( 'delay_breadcrumbs', '' ); // only in Customizer // Temporary DUPLICATE here delete_option( 'menu_ontop_preloader' ); // moved to serialized in DB: alphabet_theme_options; may remove delete_option( 'show_ajax_load' ); // moved to serialized in DB: alphabet_theme_options; may remove delete_option( 'menu_fixed' ); // moved to serialized in DB: alphabet_theme_options; may remove // Temporary DUPLICATE here delete_option( 'logo_noimage_color'); // we will use WP buit-in feature for that: theme_mod: 'header_textcolor', may delete /** Deactivation theme. */ function alphabet_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' ); // moved to serialized in DB: alphabet_theme_options; may remove //delete_option( 'menu_ontop_preloader' ); // moved to serialized in DB: alphabet_theme_options; may remove //delete_option( 'menu_fixed' ); // moved to serialized in DB: alphabet_theme_options; may remove 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' ); // we will use wp default feature. May remove. 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'); delete_option( 'animation_breadcrumbs'); // only in Customizer delete_option( 'delay_breadcrumbs'); // only in Customizer */ } add_action("switch_theme", "alphabet_mydeactivationfunction", 10 , 2); add_action('init', 'alphabet_register_nav_menus_on_init'); function alphabet_register_nav_menus_on_init() { // This theme uses wp_nav_menu() in one location. register_nav_menus(array( 'top-pages-menu' => __('My Top Pages Menu', 'alphabet'), )); } /** Import demo data theme. */ //include_once('includes/import/custom-import.php'); if ( ! isset( $content_width ) ) { $content_width = 600; } /** Include VARS from theme. */ include_once('includes/vars.php'); /** 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 alphabet_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', 'alphabet_register_my_widgets' ); /** Include Custom Template and setting Visual Composer */ function alphabet_your_name_integrateWithVC() { require_once locate_template('/vc_extend/vc_extend.php'); } add_action( 'vc_before_init', 'alphabet_your_name_integrateWithVC' ); /** Include CSS framework */ function alphabet_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', 'alphabet_social_share' ); /** Include Cliker Action and Hook */ function alphabet_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', 'alphabet_clicker_action' ); /** Include Slider Class */ function alphabet_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', 'alphabet_slider_class' ); /** Include CSS framework */ function alphabet_animation_styles() { wp_enqueue_style( 'animation-styles', esc_url( get_template_directory_uri() ).'/css/animate.css', false, '1.0', 'all'); wp_enqueue_style( 'composer-styles', esc_url( get_template_directory_uri() ).'/css/js_builder.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', 'alphabet_animation_styles' ); /** Include CSS Font Avesome */ function alphabet_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', 'alphabet_animation_avesome' ); /** Include custom Fonts*/ function alphabet_custom_fontes() { wp_enqueue_style( 'custom_fontes', esc_url( get_template_directory_uri() ).'/css/geometric-figure/style_geo.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', 'alphabet_custom_fontes' ); /** Include Upload Image n options */ function alphabet_true_include_myuploadscript() { if ( ! did_action( 'wp_enqueue_media' ) ) { wp_enqueue_media(); } } add_action( 'admin_enqueue_scripts', 'alphabet_true_include_myuploadscript' ); // For Custom Theme Options function alphabet_true_image_uploader_field( $name, $value = '', $w = 100, $h = 100) { $default = get_stylesheet_directory_uri() . '/img/no_img.png'; if( $value ) { $src = $value; if( is_numeric($src) ) { $image_attributes = wp_get_attachment_image_src( $value, 'full' ); $src = $image_attributes[0]; } } else { $src = $default; } echo '

'; } //Builder animation data function alphabet_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 alphabet_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 alphabet_option_builder($option_list, $selected_element) { $output = ''; 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 alphabet_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 alphabet_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 alphabet_add_myshortcode2($tag, $func) { global $shortcode_tags; $shortcode_tags[ $tag ] = $func; } //--------------------------- //Not Delete empty in MCE //--------------------------- function alphabet_change_mce_options( $init ) { $init['theme_advanced_blockformats'] = 'p,address,pre,code,h1,h2,h3,h4,h5,h6,span,i,style'; //$init['theme_advanced_disable'] = 'forecolor'; $init['valid_elements'] = '*[*]'; $init['extended_valid_elements'] = '*[*]'; $init['valid_children'] = '+body[style],+div[style],+p[style],+ul[style],+li[style]'; $init['verify_html'] = false; return $init; } add_filter('tiny_mce_before_init', 'alphabet_change_mce_options'); /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Print Custom Google Font link * example: '' | '//fonts.googleapis.com/css?family=Ruslan+Display|Ruslan+Display:400,400italic' * * @param type $option_type * @return null */ function alphabet_get_googlefont_link($option_type) { $googlefont_link = ''; // list of options in DB: // default_body_font // default_body_fontweight // default_body_fontstyle // // default_h1_font // default_h1_fontweight // default_h1_fontstyle // ... // default_h6_font // default_h6_fontweight // default_h6_fontstyle $correct_values = array('body', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'); if (!in_array($option_type, $correct_values)) { print $googlefont_link; return; } $option_font = 'default_'. $option_type .'_font'; $option_fontweight = 'default_'. $option_type .'_fontweight'; $option_fontstyle = 'default_'. $option_type .'_fontstyle'; // get vars for custom fonts: body, H1, ..., H6 if (get_option($option_font) && 'Default' !== get_option($option_font)) { // '' | 'Ruslan+Display' | 'Roboto' | ... $default_X_font = get_option($option_font); } if (get_option($option_fontweight)) { // '' | '400' | '100' | '700' | '900' $default_X_fontweight = get_option($option_fontweight); } else { $default_X_fontweight = ''; // 400 = 'normal' as default } if ('italic' == get_option($option_fontstyle)) { // '' | 'normal' | 'italic' | 'oblique' - in link to "googleapis" only 'italic' we need. if ('' == $default_X_fontweight) { $default_X_fontstyle = '400italic'; // 400 - it is 'normal' weight, as default } else { $default_X_fontstyle = ',' . $default_X_fontweight . 'italic'; } } else { $default_X_fontstyle = ''; } if (!empty($default_X_font)) { // create Custom Font link $glue = ''; if ('' !== $default_X_fontweight || '' !== $default_X_fontstyle) { $glue = ':'; $googlefont_link = "//fonts.googleapis.com/css?family=$default_X_font|$default_X_font$glue$default_X_fontweight$default_X_fontstyle"; } else { $googlefont_link = "//fonts.googleapis.com/css?family=$default_X_font"; } } print $googlefont_link; return; }