wordpress , problems with text blocks, they dissapear -
i'm beginner in wordpress,recently installed dokan plugin online shop, gave me problems , read solution add code
add_action('wp_enqueue_scripts', 'mgt_dequeue_stylesandscripts',99); function mgt_dequeue_stylesandscripts() { if ( class_exists( 'woocommerce' ) ) { wp_dequeue_style( 'select2' ); wp_deregister_style( 'select2' ); wp_dequeue_script( 'select2'); wp_deregister_script('select2'); } }
i using handy store template, put code in file "function", when use function, text-blocks stop working, literally disappear, , when remove code come again, how solve it?
the above problem had errors when uploading banners , photos.
the code of function this
<?php /* plumtree functions , definitions */ /** contents: - additional image sizes. - google fonts site. - handy setup. - enqueue scripts , styles. - handy init sidebars. - options panel. - adding features. - backend notifications on theme activation. **/ /* set content width value based on theme's design. */ if (!isset( $content_width )) $content_width = 1200; /* adding additional image sizes. */ if ( function_exists( 'add_image_size' ) ) { add_image_size( 'product-extra-gallery-thumb', 70, 70, true ); add_image_size( 'pt-cat-thumb', 25, 25, true ); add_image_size( 'carousel-medium', 500, 500, true); add_image_size( 'carousel-large', 760, 500, true); add_image_size( 'pt-product-thumbs', 123, 123, true); add_image_size( 'pt-recent-posts-thumb', 263, 174, true); add_image_size( 'pt-sidebar-thumbs', 80, 80, true); add_image_size( 'pt-vendor-product-thumbs', 120, 120, true); } /* setting google fonts site */ if ( ! class_exists( 'handyfonts' ) ) { class handyfonts { static function get_default_fonts() { $handy_default_fonts = array('open sans', 'roboto', 'lato'); return $handy_default_fonts; } } } /* handy setup. set theme defaults , registers support various wordpress features. */ if ( ! function_exists( 'plumtree_setup' ) ) { function plumtree_setup() { // translation availability load_theme_textdomain( 'plumtree', get_template_directory() . '/languages' ); // add rss feed links <head> posts , comments. add_theme_support( 'automatic-feed-links' ); add_theme_support( "title-tag" ); add_theme_support( "custom-header"); // enable support post thumbnails. add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 1138, 450, true ); // nav menus. register_nav_menus( array( 'header-top-nav' => __( 'top menu', 'plumtree' ), 'primary-nav' => __( 'primary menu (under logo)', 'plumtree' ), ) ); // switch default core markup search form, comment form, , comments output valid html5. add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) ); // enable support post formats. add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery', ) ); // theme allows users set custom background. add_theme_support( 'custom-background', array( 'default-color' => 'ffffff', ) ); // enable woocommerce support add_theme_support( 'woocommerce' ); // enable layouts support $pt_layouts = array( array('value' => 'one-col', 'label' => esc_html__('1 column (no sidebars)', 'plumtree'), 'icon' => get_template_directory_uri().'/theme-options/images/one-col.png'), array('value' => 'two-col-left', 'label' => esc_html__('2 columns, sidebar on left', 'plumtree'), 'icon' => get_template_directory_uri().'/theme-options/images/two-col-left.png'), array('value' => 'two-col-right', 'label' => esc_html__('2 columns, sidebar on right', 'plumtree'), 'icon' => get_template_directory_uri().'/theme-options/images/two-col-right.png'), ); add_theme_support( 'plumtree-layouts', apply_filters('pt_default_layouts', $pt_layouts) ); } } add_action( 'after_setup_theme', 'plumtree_setup' ); /* enqueue scripts , styles front end. */ function plumtree_scripts() { /* vendor store */ $vendor_shop = ''; if ( class_exists('wcv_vendors') ) { $vendor_shop = urldecode( get_query_var( 'vendor_shop' ) ); } //---- css styles wp_enqueue_style( 'pt-basic', get_stylesheet_uri() ); wp_enqueue_style( 'pt-grid-and-effects', get_template_directory_uri().'/css/grid-and-effects.css' ); wp_enqueue_style( 'pt-icon-fonts', get_template_directory_uri() . '/css/icon-fonts.min.css' ); wp_enqueue_style( 'pt-additional-styles', get_template_directory_uri().'/css/additional-styles.css' ); wp_enqueue_style( 'pt-vc-styles', get_template_directory_uri().'/css/visual-composer-styles.css' ); if ( class_exists('woocommerce') && class_exists('wcv_vendors') ) { wp_enqueue_style( 'pt-vendors-styles', get_template_directory_uri().'/css/vendor-styles.css' ); } //---- js libraries wp_enqueue_script( 'hoverintent', array('jquery') ); wp_enqueue_script( 'lazy-sizes', get_template_directory_uri() . '/js/lazysizes.js', array(), '1.5.0', false ); wp_enqueue_script( 'easings', get_template_directory_uri() . '/js/easing.1.3.js', array('jquery'), '1.3', true ); wp_enqueue_script( 'images-loaded', get_template_directory_uri() . '/js/imagesloaded.js', array('jquery'), '4.1.0', true ); wp_enqueue_script( 'countdown', get_template_directory_uri() . '/js/countdown.js', array('jquery'), '2.0.2', true ); wp_enqueue_script( 'bootstrap-js', get_template_directory_uri() . '/js/bootstrap.js', array('jquery'), '3.3.5', true ); wp_enqueue_script( 'owl-carousel', get_template_directory_uri() . '/js/owl.carousel.js', array('jquery'), '1.3.3', true ); wp_enqueue_script( 'magnific-popup', get_template_directory_uri() . '/js/magnific-popup.js', array('jquery'), '1.1.0', true ); wp_enqueue_script( 'select2', get_template_directory_uri() . '/js/select2.js', array('jquery'), '3.5.2', true ); wp_enqueue_script( 'ion-checkradio', get_template_directory_uri() . '/js/ion.checkradio.js', array('jquery'), '2.0', true ); if ( is_archive() || is_home() || is_tax() || ( $vendor_shop && $vendor_shop!='' ) || is_page_template( 'page-templates/gallery-page.php' ) || is_page_template( 'page-templates/portfolio-page.php' ) ) { wp_enqueue_script( 'isotope', get_template_directory_uri() . '/js/isotope.js', array('jquery'), '2.2.0', true ); } wp_enqueue_script( 'pt-basic-js', get_template_directory_uri() . '/js/helper.js', array('jquery'), '1.0', true ); //---- comments script----------- if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action('wp_enqueue_scripts', 'mgt_dequeue_stylesandscripts',99); function mgt_dequeue_stylesandscripts() { if ( class_exists( 'woocommerce' ) ) { wp_dequeue_style( 'select2' ); wp_deregister_style( 'select2' ); wp_dequeue_script( 'select2'); wp_deregister_script('select2'); } } add_action( 'wp_enqueue_scripts', 'plumtree_scripts' ); /* handy init sidebars. */ if (!function_exists('plumtree_widgets_init')){ function plumtree_widgets_init() { // default sidebars register_sidebar( array( 'name' => __( 'blog sidebar', 'plumtree' ), 'id' => 'sidebar-blog', 'description' => __( 'appears on single blog posts , on blog page', 'plumtree' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title" itemprop="name">', 'after_title' => '</h3>', ) ); if ( handy_get_option('header_top_panel') == 'on' ) { register_sidebar( array( 'name' => __( 'header top panel sidebar', 'plumtree' ), 'id' => 'top-sidebar', 'description' => __( 'located @ top of site', 'plumtree' ), 'before_widget' => '<aside id="%1$s" class="%2$s right-aligned">', 'after_widget' => '</aside>', 'before_title' => '<!--', 'after_title' => '-->', ) ); } register_sidebar( array( 'name' => __( 'header (logo group) sidebar', 'plumtree' ), 'id' => 'hgroup-sidebar', 'description' => __( 'located right header', 'plumtree' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '', 'after_title' => '', ) ); register_sidebar( array( 'name' => __( 'front page sidebar', 'plumtree' ), 'id' => 'sidebar-front', 'description' => __( 'appears when using optional front page template page set static front page', 'plumtree' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title itemprop="name">', 'after_title' => '</h3>', ) ); register_sidebar( array( 'name' => __( 'pages sidebar', 'plumtree' ), 'id' => 'sidebar-pages', 'description' => __( 'appears on pages', 'plumtree' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title itemprop="name">', 'after_title' => '</h3>', ) ); if ( class_exists('woocommerce') ) { register_sidebar( array( 'name' => __( 'shop page sidebar', 'plumtree' ), 'id' => 'sidebar-shop', 'description' => __( 'appears on products page', 'plumtree' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title itemprop="name">', 'after_title' => '</h3>', ) ); register_sidebar( array( 'name' => __( 'single product page sidebar', 'plumtree' ), 'id' => 'sidebar-product', 'description' => __( 'appears on single products page', 'plumtree' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title itemprop="name">', 'after_title' => '</h3>', ) ); if ( class_exists('wcv_vendors') ) { register_sidebar( array( 'name' => __( 'vendor shop page sidebar', 'plumtree' ), 'id' => 'sidebar-vendor', 'description' => __( 'appears on vendors shop page', 'plumtree' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title itemprop="name">', 'after_title' => '</h3>', ) ); } } // footer sidebars register_sidebar( array( 'name' => __( 'footer sidebar col#1', 'plumtree' ), 'id' => 'footer-sidebar-1', 'description' => __( 'located in footer of site', 'plumtree' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title itemprop="name">', 'after_title' => '</h3>', ) ); register_sidebar( array( 'name' => __( 'footer sidebar col#2', 'plumtree' ), 'id' => 'footer-sidebar-2', 'description' => __( 'located in footer of site', 'plumtree' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title itemprop="name">', 'after_title' => '</h3>', ) ); register_sidebar( array( 'name' => __( 'footer sidebar col#3', 'plumtree' ), 'id' => 'footer-sidebar-3', 'description' => __( 'located in footer of site', 'plumtree' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title itemprop="name">', 'after_title' => '</h3>', ) ); register_sidebar( array( 'name' => __( 'footer sidebar col#4', 'plumtree' ), 'id' => 'footer-sidebar-4', 'description' => __( 'located in footer of site', 'plumtree' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title itemprop="name">', 'after_title' => '</h3>', ) ); // custom sidebars register_sidebar( array( 'name' => __( 'top footer sidebar', 'plumtree' ), 'id' => 'top-footer-sidebar', 'description' => __( 'located in footer of site', 'plumtree' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title itemprop="name">', 'after_title' => '</h3>', ) ); if ( handy_get_option('filters_sidebar')=='on' ) { register_sidebar( array( 'name' => __( 'special filters sidebar', 'plumtree' ), 'id' => 'filters-sidebar', 'description' => __( 'located @ top of products page', 'plumtree' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="dropdown-filters-title">', 'after_title' => '</h3>', ) ); } if ( handy_get_option('front_page_special_sidebar')=='on' ) { register_sidebar( array( 'name' => __( 'special front page sidebar', 'plumtree' ), 'id' => 'front-special-sidebar', 'description' => __( 'located @ bottom of page (appears when using front page template)', 'plumtree' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s col-xs-12 col-sm-6 col-md-3 lazyload" data-expand="-100" >', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title" itemprop="name">', 'after_title' => '</h3>', ) ); } } add_action( 'widgets_init', 'plumtree_widgets_init' ); } /* options panel */ define( 'options_framework_directory', get_template_directory_uri() . '/theme-options/' ); require_once ( get_template_directory() . '/theme-options/options-framework.php' ); // loads options.php child or parent theme $optionsfile = locate_template( 'options.php' ); load_template( $optionsfile ); function handy_prefix_options_menu_filter( $menu ) { $menu['mode'] = 'menu'; $menu['page_title'] = esc_html__( 'handy theme options', 'plumtree'); $menu['menu_title'] = esc_html__( 'handy theme options', 'plumtree'); $menu['menu_slug'] = 'handy-theme-options'; return $menu; } add_filter( 'optionsframework_menu', 'handy_prefix_options_menu_filter' ); /* adding features */ // widgets require_once( get_template_directory() . '/widgets/class-pt-widget-contacts.php'); require_once( get_template_directory() . '/widgets/class-pt-widget-socials.php'); require_once( get_template_directory() . '/widgets/class-pt-widget-search.php'); require_once( get_template_directory() . '/widgets/class-pt-widget-login.php'); require_once( get_template_directory() . '/widgets/class-pt-widget-most-viewed-posts.php'); require_once( get_template_directory() . '/widgets/class-pt-widget-recent-posts.php'); require_once( get_template_directory() . '/widgets/class-pt-widget-comments-with-avatars.php'); require_once( get_template_directory() . '/widgets/pay-icons/class-pt-widget-pay-icons.php'); if ( class_exists('woocommerce') ) { require_once( get_template_directory() . '/widgets/class-pt-widget-cart.php'); require_once( get_template_directory() . '/widgets/class-pt-widget-categories.php'); } if ( handy_get_option('site_post_likes')=='on' ) { require_once( get_template_directory() . '/widgets/class-pt-widget-user-likes.php'); require_once( get_template_directory() . '/widgets/class-pt-widget-popular-posts.php'); } if ( class_exists('woocommerce') && class_exists('wcv_vendors') ) { require_once( get_template_directory() . '/widgets/class-pt-widget-vendors-products.php'); } // required functions require_once( get_template_directory() . '/inc/pt-google-fonts.php'); require_once( get_template_directory() . '/inc/pt-theme-layouts.php'); require_once( get_template_directory() . '/inc/pt-functions.php'); require_once( get_template_directory() . '/inc/pt-login-register.php'); require_once( get_template_directory() . '/inc/pt-tgm-plugin-activation.php'); require_once( get_template_directory() . '/inc/pt-self-install.php'); if ( handy_get_option('blog_share_buttons')=='on' || handy_get_option('use_pt_shares_for_product')=='on' ) { require_once( get_template_directory() . '/inc/pt-share-buttons.php'); } if ( handy_get_option('site_post_likes')=='on' ) { require_once( get_template_directory() . '/inc/pt-post-like.php'); } if ( class_exists('woocommerce') ) { require_once( get_template_directory() . '/inc/pt-woo-modification.php'); } if ( class_exists('wcv_vendors') ) { require_once( get_template_directory() . '/inc/pt-vendors-modification.php'); if ( handy_get_option('show_wcv_favourite_vendors')=='on' ) { require_once( get_template_directory() . '/inc/pt-favourite-vendors.php'); } } if ( handy_get_option('blog_pagination')=='infinite' ) { require_once( get_template_directory() . '/inc/pt-infinite-blog.php'); } if ( handy_get_option('site_custom_colors') == 'on') { require_once( get_template_directory() . '/inc/pt-color-sheme.php'); } // adding pagebuilders custom shortcodes if (class_exists('ig_pb_init')) { require_once( get_template_directory() . '/shortcodes/add_to_contentbuilder.php' ); } if ( class_exists( 'wpbakeryshortcode' ) ) { require_once( get_template_directory() . '/shortcodes/composer_shortcodes/banner.php'); require_once( get_template_directory() . '/shortcodes/composer_shortcodes/contact-member.php'); require_once( get_template_directory() . '/shortcodes/composer_shortcodes/recent-post.php'); require_once( get_template_directory() . '/shortcodes/composer_shortcodes/carousel.php'); require_once( get_template_directory() . '/shortcodes/composer_shortcodes/sale-carousel.php'); require_once( get_template_directory() . '/shortcodes/composer_shortcodes/testimonials.php'); require_once( get_template_directory() . '/shortcodes/composer_shortcodes/woo-codes.php'); require_once( get_template_directory() . '/shortcodes/composer_shortcodes/vendors-carousel.php'); require_once( get_template_directory() . '/shortcodes/composer_shortcodes/promo-text.php'); } // add do_shortcode filter. add_filter('widget_text', 'do_shortcode'); // live preview rtl if( isset( $_get['rtl_demo'] ) && $_get['rtl_demo']=='true' ){ function add_rtl_css() { wp_enqueue_style( 'plumtree-rtl', get_template_directory_uri().'/rtl.css' ); } add_action( 'wp_enqueue_scripts', 'add_rtl_css' ); } /* backend notifications on theme activation */ //add_action('after_switch_theme', 'pt_add_alerts'); function pt_add_alerts () { add_action( 'admin_notices', 'pt_add_alert_text' ); } function pt_add_alert_text() { echo ' <div class="notice error is-dismissible"> <p><strong style="color: #dc3232;">warning!</strong> recommended read our instructions before installing sample data, may destroy existing data!</p> <p>we offer <strong>paid sample data installation</strong>. please contact support on matter!</p> <p><strong><a href="http://handystorehelp.themes.zone/#installing-sample-data" rel="nofollow" target="_blank">read instructions</a></strong> | <strong><a href="http://support.themes.zone/" rel="nofollow" target="_blank">contact support</a></strong></p> </div>'; } /* registers editor stylesheet theme. */ function handy_theme_add_editor_styles() { add_editor_style( 'custom-editor-style.css' ); } add_action( 'admin_init', 'handy_theme_add_editor_styles' );
Comments
Post a Comment