Home › Forums › WoodMart support forum › Functions.js file
Functions.js file
- This topic has 21 replies, 2 voices, and was last updated 6 years, 4 months ago by Artem Temos.
-
AuthorPosts
-
July 24, 2018 at 1:27 pm #68986
Stanley BlackParticipantHello,
Functions.js file not compiling in functions.min.js file.
Functions.js is not usable. Only changes in functions.min.js take effects.
Best regards
July 24, 2018 at 1:40 pm #68989
Artem TemosKeymasterHi,
Yes, it doesn’t compile it automatically. There is no JS uglify library built in our theme. If you want to compile it automatically you will need to install node.js, grunt or gulp and uglify library on your machine.
Kind Regards
July 25, 2018 at 10:32 am #69158
Stanley BlackParticipantThanks for response.
I want to dequeue functions.min.js in my child-theme/functions.php file and than to enqueue
functions.min.js from child theme.
But wp_dequeue_script( ” ); not take effect at all.Can you give me a little help how to achieve that?
Kind regards
July 25, 2018 at 11:11 am #69163
Stanley BlackParticipantSomething like this.
function something_scripts() {
wp_dequeue_script( ‘woodmart-theme’ );
wp_enqueue_script( ‘woodmart-theme’, get_stylesheet_directory_uri() . ‘/js/functions.min.js’ );
}
add_action( ‘wp_print_scripts’, ‘something_scripts’ );This dequeue function.min.js but engueue the same file not function.min.js from child theme.
July 25, 2018 at 11:24 am #69168
Stanley BlackParticipantI now that this line is problem
wp_enqueue_script( ‘woodmart-theme’, get_stylesheet_directory_uri() . ‘/js/functions.min.js’ );
Why import file from parent theme, not from child theme(js/functions.min.js).
Is it necessary to change name of script ‘woodmart-theme’?
Kind regards
July 25, 2018 at 11:39 am #69170
Artem TemosKeymasterTry to add the following PHP code snippet to the child theme functions.php file to do this
function woodmart_child_enqueue_scripts() { wp_deregister_script( 'woodmart-theme' ); wp_enqueue_script( 'woodmart-theme', get_stylesheet_directory_uri() . '/child.js' ); } add_action( 'wp_enqueue_scripts', 'woodmart_child_enqueue_scripts', 1000000 );
July 25, 2018 at 12:15 pm #69176
Stanley BlackParticipantIn view page source is right path
<script type=’text/javascript’ src=’http://www.roda.local/wp-content/themes/woodmart-idc/functions.min.js?ver=4.9.6′></script>
but with no effect because
ReferenceError: woodmart_settings is not defined[Learn More] functions.min.js:1:1198
July 25, 2018 at 12:25 pm #69179
Artem TemosKeymasterDid you use only our code? Please, send us your website link.
July 25, 2018 at 7:59 pm #69251
Stanley BlackParticipantI modified functions.min.js but when restore this file from fresh theme installation the same error show up.
Uncaught ReferenceError: woodmart_settings is not defined
at functions.min.js?ver=4.9.7:1
at functions.min.js?ver=4.9.7:3
at functions.min.js?ver=4.9.7:3July 25, 2018 at 9:47 pm #69261
Artem TemosKeymasterPlease, send us your FTP access so we can check what is wrong.
July 26, 2018 at 9:10 am #69337
Stanley BlackParticipantHello,
thanks in advance!
July 26, 2018 at 9:21 am #69341
Artem TemosKeymasterYou need to add our settings array before that code also. So the full code will be
function woodmart_child_enqueue_scripts() { $translations = array( 'adding_to_cart' => esc_html__('Processing', 'woodmart'), 'added_to_cart' => esc_html__('Product was successfully added to your cart.', 'woodmart'), 'continue_shopping' => esc_html__('Continue shopping', 'woodmart'), 'view_cart' => esc_html__('View Cart', 'woodmart'), 'go_to_checkout' => esc_html__('Checkout', 'woodmart'), 'loading' => esc_html__('Loading...', 'woodmart'), 'countdown_days' => esc_html__('days', 'woodmart'), 'countdown_hours' => esc_html__('hr', 'woodmart'), 'countdown_mins' => esc_html__('min', 'woodmart'), 'countdown_sec' => esc_html__('sc', 'woodmart'), 'wishlist' => ( class_exists( 'YITH_WCWL' ) ) ? 'yes' : 'no', 'cart_url' => ( woodmart_woocommerce_installed() ) ? esc_url( wc_get_cart_url() ) : '', 'ajaxurl' => admin_url('admin-ajax.php'), 'add_to_cart_action' => ( woodmart_get_opt( 'add_to_cart_action' ) ) ? esc_js( woodmart_get_opt( 'add_to_cart_action' ) ) : 'widget', 'added_popup' => ( woodmart_get_opt( 'added_to_cart_popup' ) ) ? 'yes' : 'no', 'categories_toggle' => ( woodmart_get_opt( 'categories_toggle' ) ) ? 'yes' : 'no', 'enable_popup' => ( woodmart_get_opt( 'promo_popup' ) ) ? 'yes' : 'no', 'popup_delay' => ( woodmart_get_opt( 'promo_timeout' ) ) ? (int) woodmart_get_opt( 'promo_timeout' ) : 1000, 'popup_event' => woodmart_get_opt( 'popup_event' ), 'popup_scroll' => ( woodmart_get_opt( 'popup_scroll' ) ) ? (int) woodmart_get_opt( 'popup_scroll' ) : 1000, 'popup_pages' => ( woodmart_get_opt( 'popup_pages' ) ) ? (int) woodmart_get_opt( 'popup_pages' ) : 0, 'promo_popup_hide_mobile' => ( woodmart_get_opt( 'promo_popup_hide_mobile' ) ) ? 'yes' : 'no', 'product_images_captions' => ( woodmart_get_opt( 'product_images_captions' ) ) ? 'yes' : 'no', 'ajax_add_to_cart' => ( apply_filters( 'woodmart_ajax_add_to_cart', true ) ) ? woodmart_get_opt( 'single_ajax_add_to_cart' ) : false, 'all_results' => esc_html__('View all results', 'woodmart'), 'product_gallery' => woodmart_get_product_gallery_settings(), 'zoom_enable' => ( woodmart_get_opt( 'image_action' ) == 'zoom') ? 'yes' : 'no', 'ajax_scroll' => ( woodmart_get_opt( 'ajax_scroll' ) ) ? 'yes' : 'no', 'ajax_scroll_class' => apply_filters( 'woodmart_ajax_scroll_class' , '.main-page-wrapper' ), 'ajax_scroll_offset' => apply_filters( 'woodmart_ajax_scroll_offset' , 100 ), 'infinit_scroll_offset' => apply_filters( 'woodmart_infinit_scroll_offset' , 300 ), 'product_slider_auto_height' => ( woodmart_get_opt( 'product_slider_auto_height' ) ) ? 'yes' : 'no', 'header_builder' => ( woodmart_get_opt( 'header_builder' ) ) ? 'yes' : 'no', 'price_filter_action' => ( apply_filters( 'price_filter_action' , 'click' ) == 'submit' ) ? 'submit' : 'click', 'product_slider_autoplay' => apply_filters( 'woodmart_product_slider_autoplay' , false ), 'loading' => esc_html__( 'Loading...', 'woodmart' ), 'close' => esc_html__( 'Close (Esc)', 'woodmart' ), 'share_fb' => esc_html__( 'Share on Facebook', 'woodmart' ), 'pin_it' => esc_html__( 'Pin it', 'woodmart' ), 'tweet' => esc_html__( 'Tweet', 'woodmart' ), 'download_image' => esc_html__( 'Download image', 'woodmart' ), 'cookies_version' => ( woodmart_get_opt( 'cookies_version' ) ) ? (int)woodmart_get_opt( 'cookies_version' ) : 1, 'header_banner_version' => ( woodmart_get_opt( 'header_banner_version' ) ) ? (int)woodmart_get_opt( 'header_banner_version' ) : 1, 'promo_version' => ( woodmart_get_opt( 'promo_version' ) ) ? (int)woodmart_get_opt( 'promo_version' ) : 1, 'header_banner_close_btn' => woodmart_get_opt( 'header_close_btn' ), 'header_banner_enabled' => woodmart_get_opt( 'header_banner' ), 'whb_header_clone' => woodmart_get_config( 'header-clone-structure' ), 'pjax_timeout' => apply_filters( 'woodmart_pjax_timeout' , 5000 ), 'split_nav_fix' => apply_filters( 'woodmart_split_nav_fix' , false ), 'shop_filters_close' => woodmart_get_opt( 'shop_filters_close' ) ? 'yes' : 'no', 'woo_installed' => woodmart_woocommerce_installed(), 'base_hover_mobile_click' => woodmart_get_opt( 'base_hover_mobile_click' ) ? 'yes' : 'no', 'centered_gallery_start' => apply_filters( 'woodmart_centered_gallery_start' , 1 ), ); wp_deregister_script( 'woodmart-theme' ); wp_enqueue_script( 'woodmart-theme', get_stylesheet_directory_uri() . '/js/functions.min.js' ); wp_localize_script( 'woodmart-theme', 'woodmart_settings', $translations ); } add_action( 'wp_enqueue_scripts', 'woodmart_child_enqueue_scripts', 1000000 );
July 26, 2018 at 9:33 am #69349
Stanley BlackParticipantThanks!!!
it’s works but one problem left.
Instagram slider not take effects.
Kind regards
July 26, 2018 at 9:45 am #69354
Artem TemosKeymasterWhat instagram slider problem do you mean?
July 26, 2018 at 9:54 am #69359
Stanley BlackParticipantTake a look of my website, I remove code from functions.php.
That look of instagram slider I want.It seems when your code is added in functions.php, instagram slider not receive custom style from style.css.
July 26, 2018 at 9:56 am #69362
Artem TemosKeymasterPlease, describe to us your problem in a bit more details. Attach some screenshots and provide us with a list of steps on how to reproduce it on your website.
Thank you in advance.
July 26, 2018 at 10:11 am #69369
Stanley BlackParticipantI customize instagram slider in my child theme(style.css).
Import custom arrows, decrease images, padding between images…(screenshot1.png).When I added your code for deregister script and enqueue script, instagram slider not have custom styles from my child theme, everyting gone(custom arrows, decrease images, padding between images…).screenshot2.png.
Kind regards
Attachments:
You must be logged in to view attached files.July 26, 2018 at 11:36 am #69380
Artem TemosKeymasterBut we don’t know how did you add your styles. The code we gave is just for JS script loaded from child theme. Maybe you did something wrong but additional code customizations are out of our theme support scope.
August 1, 2018 at 9:02 am #70327
Stanley BlackParticipantHello,
Maybe in function woodmart_child_enqueue_scripts() is not script for instagram slider and then instagram slider not have his classes.
All this classes has gone, they are invisibile, !important does not make a difference.
.instagram-with-spaces.instagram-slider .owl-item {
padding-left: 25px;
padding-right: 25px;
}.instagram-pics.owl-carousel .owl-nav > div {
transform: translateY(0);
-webkit-transform: translateY(0);
opacity: 1;
visibility: visible;
pointer-events: visible;
}
.owl-nav>div[class*=prev]:after, .wrap-loading-arrow>div[class*=prev]:after {
content: url(“http://www.new.idc.rs/wp-content/uploads/2018/05/left-arrow.png”);
margin-left: 52px;
}.owl-nav>div[class*=next]:after, .wrap-loading-arrow>div[class*=next]:after {
content: url(“http://www.new.idc.rs/wp-content/uploads/2018/05/right-arow.png”);
margin-right: 50px;
}Kind regards
August 1, 2018 at 9:07 am #70329
Artem TemosKeymasterHi,
Instagram scripts are not overridden in the child theme and CSS classes are the same there.
Regards
August 1, 2018 at 9:29 am #70333
Stanley BlackParticipantThanks for response.
I can’t find why instagram slider can’t be modified in style.css when functions.js is call from child theme.
I will use some third plugin for instagram slider.
Best regards
August 1, 2018 at 11:20 am #70363
Artem TemosKeymasterOK, contact us if you will have any extra questions.
-
AuthorPosts
- You must be logged in to create new topics. Login / Register