-
AuthorPosts
-
June 10, 2022 at 3:04 pm #1354818
Hello there,
today i updatet the theme to the latest version and my customization in funtion.php does not work anymore.
The customization is done in child theme function.php. Maybe there was a change in code with this update and now the script is just not responding anymore but i cant find the problem/solution.
————————————————————–
This is the customization we did://------------------------------- // Blackout Custom script in footer //------------------------------- function blackout_change_logo_header(){ ?> <script> var $=jQuery.noConflict(); function darkmode_fix(){ // listen to the click to the dark mode toggle $('.darkmode-toggle').click( function() { if ($('body').hasClass('darkmode--activated')) { $(".logo > a > img").attr("src","https://aedenberlin.com/wp-content/uploads/2021/02/aeden-logo_invert.svg"); // if dark mode is active change the image for the inverted one $(".avia-image-container-inner > div > img").attr("src","https://aedenberlin.com/wp-content/uploads/2021/04/aeden-lettering-1-1.svg"); // if dark mode is active change the image for the inverted one }else{ $(".logo > a > img").attr("src","https://aedenberlin.com/wp-content/uploads/2021/01/ae-logo-2.svg"); // if dark mode is inactive change it to the original $(".avia-image-container-inner > div > img").attr("src","https://aedenberlin.com/wp-content/uploads/2021/04/aeden-lettering-1.svg"); // if dark mode is inactive change it to the original } } ); } jQuery(document).ready(function($){ darkmode_fix(); }); </script> <?php } add_action('wp_footer', 'blackout_change_logo_header');
I would really appreciate your help.
Beste regards
Luca- This topic was modified 2 years, 5 months ago by snorlachs.
June 11, 2022 at 4:33 pm #1354915Hey snorlachs,
Thank you for the login, your script is looking to replace the source url of .logo > a > img
but when you use a SVG logo there is no img tag it is a SVG tag and thre is no url it is a clippath because it has already been rendered:
Try using png images instead of svgBest regards,
MikeJune 15, 2022 at 12:30 am #1355265first – see Mikes hint –
because we now have inline svg files – you maybe change the fill from a given path with change of darkmode.
second : the update must be a big one – because the click function is deprecated since jQuery 3 :// $('.darkmode-toggle').click(function() { // use instead: $('.darkmode-toggle').on('click', function(){
-
AuthorPosts
- You must be logged in to reply to this topic.