I'm having a lot of difficulties linking JS and CSS files to my custom home page
-
I’ve been trying for several weeks to set up a custom home page on my WordPress site. I coded a page with the necessary PHP for WordPress to recognize it as a template. I choose that template when I’m setting up the page and that all seems to work great.
The problem I’m running into is that I cant’ seem to get WordPress to recognize my external JS AND CSS files. I’ve tried using the CSS/JavaScript Toolbox plugin to link the files to the page. I’ve also tried creating a plugin to register the files using wp_register and adding the wp_enqueue to the page PHP file. Neither of these options seem to work because all I ever see is the basic HTML when I load the page.
Will someone please help me try to figure this out. I feel like it should be much easier than I’m making it.
Here’s the code I used for the plugin.
function home_page_files() { //wp_enqueue_script('jquery'); wp_register_script( 'add-home-js', get_template_directory_uri() . '/AnimatedContentMenu/js/jquery.easing.1.3.js', array('jquery'),'',true ); wp_register_style( 'add-home-css', get_template_directory_uri() . '/AnimatedContentMenu/css/style.css','','', 'screen' ); wp_enqueue_script( 'add-home-js' ); wp_enqueue_style( 'add-home-css' ); } add_action( 'wp_enqueue_scripts', 'home_page_files' );
- The topic ‘I'm having a lot of difficulties linking JS and CSS files to my custom home page’ is closed to new replies.