PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, March 13, 2022

[FIXED] Wordpress/JavaScript troubles

 March 13, 2022     javascript, wordpress, wordpress-theming     No comments   

Issue

I'm working on a Wordpress site and I want to use a sliding gallery that I wrote. I've been trying to enqueue it and I'm not having any luck getting it to work. When I look at the developer tools to see what sources are being pulled/if the console is throwing any errors, I'm not even seeing the JavaScript file show up.

file structure as shown on google dev tools for front-page.php (where the slider will exist) Screenshot of the file structure in the Google Developer tools Source tab

file structure as shown on google dev tools for all other pages enter image description here

functions.php code:

function glv_scripts() {
    wp_enqueue_style( 'glv-style', get_stylesheet_uri(), array(), _S_VERSION );
    wp_enqueue_script( 'script', get_template_directory_uri() . '/js/script.js', array(), null, true );
}
add_action( 'wp_enqueue_scripts', 'glv_scripts' );

Solution

I finally realized I was missing the footer call in front-page.php, so it wasn't showing up because I had it set to true for the footer but forgot the footer. :S



Answered By - monkeyduo
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing