How to bring the javascript file to the wordpress theme via code

Asked

Viewed 339 times

0

I have two javascript files inside a folder called (js) and I want to know how to call it in the code of the theme I’m creating. But how do I do that, I know I have to use functions.php or am I wrong? I ask you to help me because I am new in creating wordpress themes and I am as much difficulty to solve this.

with the css I did this and it worked

<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url') ?>/style.css" media="screen,projection"/>
  • 1

    Have you searched the documentation? https://developer.wordpress.org/themes/basics/including-css-javascript/

  • Thanks for the answer already solved the problem, I put a Function that logs in the login the scripts loaded in the footer. Thank you

  • If you solved the problem, post the solution as an answer.

1 answer

1


I use it like this.

For javascript:

wp_enqueue_script('scripts', get_bloginfo('template_url') . '/assets/js/scripts.js',array('jquery'));

To style:

wp_enqueue_style('responsive', get_bloginfo('template_url') . '/assets/css/responsivo.css', array(), '1.0', 'all');

Browser other questions tagged

You are not signed in. Login or sign up in order to post.