-
AuthorPosts
-
March 17, 2021 at 3:18 pm #1288733
Hi,
I’m using a (possibly old version) of the Enfold Child Theme with the newest version of the Enfold theme.
Since this update I’ve been getting magnificPopup is not a function errors.I’ve tried adding the .js file for magnificPopup to the files by adding this line to the functions.php of my child theme:
wp_enqueue_script( 'avia-popup-js', get_template_directory_uri() . '/js/aviapopup/jquery.magnific-popup.min.js', array('jquery'), '1.0.0', true);
but this does not seem to work.What else can I do to try and fix this?
Kind regards
March 17, 2021 at 3:39 pm #1288738but magnific-popup is part of Enfold – did you deregister the parent script in your child-theme before ?
wp_deregister_script( 'avia-popup-js' ); wp_enqueue_script( 'avia-popup-js-child', get_stylesheet_directory_uri().'/js/aviapopup/jquery.magnific-popup.min.js', array('jquery'), $vn, true);
so what is your benefit to have an own child-theme loading of the script? It is already loaded!
“I’m using a (possibly old version)…”
Or maybe you have a misconception about how a child theme interacts with the parent theme?A child theme on its fundamental construction has three files – a style.css – and that is the basic part telling WordPress that eventually parts will be added to the parent theme; an initially still empty functions.php and a thumbnail for the dashboard.
Files with the same name in the child theme folder replace the corresponding files in the parent theme – except for the functions.php file.
The functions.php is used to add additional properties to the parent theme via code snippets. These snippets can of course also override parent theme functions through certain phrases.March 18, 2021 at 12:09 pm #1288940Hi, thank you for the response!
Yes, I’ve had a couple misconceptions but I’ve been reading up about the general Child theme idea.
I can see the (conditional) enqueue_script call in the parent theme’s function.php so that should’ve been fine I guess.
I tried adding that piece of code to the functions.php of the child theme to be sure it was loaded, but it did not help (as stated before).
I will remove it again, since it’s not needed.I see the condition for the loading of the magnific-popup plugin is the ‘use_standaard_lightbox’ option which I’ve checked is turned on in the Enfold options.
Well, I’ve turned it off for now so that the website loads correctly.I’ve added my credentials to the private content, if you could please have a look and see if I’ve overlooked something.
Please don’t make any changes directly if possible. I’d like to know what needs changes so that I can do them myself.Kind regards
EDIT:
I’ve been looking in to the child functions.php file and I’ve noticed that there was a dequeue_script for ‘avia-default’ which then loads a custom avia.js script from the child theme folder. I’ve disabled this for testing and now I can enable the use_standard_lightbox option again without issues… I’ll probably need to figure out why this file was created in the first place. I’m assuming now that this isn’t an Enfold theme issue anymore.- This reply was modified 3 years, 8 months ago by debucktravel.
March 18, 2021 at 9:04 pm #1289052my question was – for what you load a script in child, which is already loaded via parent theme.
It would only make sense if you have made changes to the script. – However, then it must be done as I showed – first deregister the parent script and then load the script in the child theme. ( and your folder-structure is the same as above: child-theme/js/aviapopup/ )
The : Enfold – Theme Options – “Lightbox Modal Window” – it is on default checked.
So just leave it activated and take this loading of the script out of your child theme better again.
Did you use the predefined child-theme of enfold? : Link
Why do you think that something is not loaded correctly ?Or is it an older install that you have updated to newest Enfold?
there are some instructions concerning to lightbox in the header.php – so if you got in your child-theme an older header.php – you had to bring this file again to the newest version and place your changings in it again.March 21, 2021 at 8:39 am #1289400 -
AuthorPosts
- You must be logged in to reply to this topic.