Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #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, 6 months ago by snorlachs.
    #1354915

    Hey 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:
    2022-06-11_004.jpg
    Try using png images instead of svg

    Best regards,
    Mike

    #1355265

    first – 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(){
    
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.