• Resolved Garanaw

    (@garanaw)


    Hello: I’m writting a theme with woocommerce and instagram feed plugins. Also I got a code from facebook to display the customer’s facebook page. I didn’t notice it to happen before including the facebook plugin (not a wordpress plugin, just a few javascript lines right below the <body> tag), but after including and styling it, it happened that my footer’s javascript appears duplicated, once on a <script src=jsfile.js”></script> way and once on a <script>code</script> way. The second one appears printed on my footer and displayed on the page. If i avoid to call the wp_footer() function it doesn’t appear, of course, but it’s not the best way to fix it as i need some files included there. I tried disabling the plugins and commenting the facebook plugin as well, but it still appears.
    The code I got to display the facebook page comes from this facebook page
    This is my footer:

    <footer>
    <?php
    $args = array('theme_location'=>'foot-m', 'menu-id'=>'footer_menu', 'container_class'=>'menu');
    echo wp_nav_menu($args);
    wp_footer();
    ?>
    <!--div class="fb-page" data="....."....><more tags="here"></div-->
    </footer>
    </body>
    </html>

    What do I have to do for the double javascript to get away from there?
    Thank you so much in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Hi there!

    Does this happen if you use a different theme? Are you able to post a link to the site?

    Thread Starter Garanaw

    (@garanaw)

    Nope, same script appears on the footer, but I cannot see it on my screen. It makes me think that probably has something to do with the files i enqueued on my functions.php file, i got this function:

    function my_scripts(){
    
    	wp_deregister_script('jquery');
    	wp_register_script('jquery', "https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js", false, '2.2.0', true);
    	wp_enqueue_script('jquery');
    
    	wp_register_script('menu-functions', get_template_directory_uri().'/js/menu.js', array('jquery'), '1.0.0', true);
    	wp_enqueue_script('menu-functions');
    
    	wp_register_style('reset', get_template_directory_uri().'/css/reset.css', false, '1.0.1', false);
    	wp_enqueue_style('reset');
    
    	wp_register_style('style', get_template_directory_uri().'/style.css', false, '1.0.1', false);
    	wp_enqueue_style('style');
    
    	wp_register_style('header', get_template_directory_uri().'/css/header.css', false, '1.0.1', false);
    	wp_enqueue_style('header');
    
    	wp_register_style('content', get_template_directory_uri().'/css/content.css', false, '1.0.1', false);
    	wp_enqueue_style('content');
    
    	if(is_front_page()){
    		wp_register_script('bxslider_script', get_template_directory_uri().'/js/jquery.bxslider.min.js', array('jquery'), '1.1.0', false);
    		wp_enqueue_script('bxslider_script');
    
    		wp_register_script('bxslider_style', get_template_directory_uri().'/js/galery.js', array('jquery', 'bxslider_script'), '3.3.5', false);
    		wp_enqueue_script('bxslider_style');
    
    		wp_register_style('bxslider_galery', get_template_directory_uri().'/css/jquery.bxslider.css', NULL, '4.4.2', 'screen');
    		wp_enqueue_style('bxslider_galery');
    
    		wp_register_style('front', get_template_directory_uri().'/css/front.css', NULL, '1.0.0', 'screen');
    		wp_enqueue_style('front');
    	}
    	if(function_exists('is_shop') AND is_shop()){
    		wp_register_style('shop', get_template_directory_uri().'/css/shop.css', NULL, '1.0.0', 'screen');
    		wp_enqueue_style('shop');
    		wp_register_script('shop', get_template_directory_uri().'/js/shop.js', array('jquery'), '1.0.0', false);
    		wp_enqueue_script('shop');
    	}
    
    	wp_register_style('footer', get_template_directory_uri().'/css/footer.css', false, '1.0.1', false);
    	wp_enqueue_style('footer');
    }
    add_action('wp_enqueue_scripts', 'kwind_scripts', 11);
    Thread Starter Garanaw

    (@garanaw)

    Sorry, i forgot to tell you, I’m writing it on localhost, i can’t upload it to any host yet, still waiting to get the domain and host

    Thread Starter Garanaw

    (@garanaw)

    Ok, solved… It was something stupid: i had a footer > *{display:inline-block;} in my css, and that was printing the scripts.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Javascript displayed on my footer’ is closed to new replies.