turnabout_badger
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: WordPress site is excessively slow, no idea whyIt’s probably not the host either, because we’ve tried transferring the entire website on our development server and it’s still just as slow, even with all the plugins deactivated and a basic theme installed. Every other client site on our servers are fine. We’re pretty stumped.
I’ll look over those resources, thanks.
Forum: Fixing WordPress
In reply to: Can't link to .js file in child-theme headerWell, I ended up reverting to just using script tags in header.php. The link now works by using get_stylesheet_directory_uri(), and the is_home conditional functions properly when used there rather than in functions.php. I guess there’s no way for functions.php to tell what the current page is?
Thanks for the help.
Forum: Fixing WordPress
In reply to: Can't link to .js file in child-theme headerThat should be fine.
Forum: Fixing WordPress
In reply to: Can't link to .js file in child-theme headerYou mean just a screenshot of the page or?
Forum: Fixing WordPress
In reply to: Can't link to .js file in child-theme headerIf I remove the conditionals, the script runs just fine. Right now, it’s just an alert() to test if it works.
Forum: Fixing WordPress
In reply to: Can't link to .js file in child-theme headerNeither of those conditions seem to work. It works when I do it directly in the header or footer, but not in functions.php.
Forum: Fixing WordPress
In reply to: Can't link to .js file in child-theme headerUsing get_stylesheet_directory_uri() seems to have done the trick. One more thing… How would I go about adding the script for specific pages only? For example, if I only wanted it to run on the front page. I tried using this if statement:
if (is_front_page()) { add_action( 'wp_enqueue_scripts', 'responsive_child_scripts_1' ); }But it doesn’t seem to work.
Forum: Fixing WordPress
In reply to: Can't link to .js file in child-theme headerHi, thanks for your answer.
I’ve tried adding the following code in my child theme’s function.php file:
<?php function responsive_child_scripts() { wp_enqueue_script( 'test.js', get_stylesheet_directory() . '/test.js' ); } add_action( 'wp_enqueue_scripts', 'responsive_child_scripts' ); ?>I’m still getting the same “Failed to load resource: the server responded with a status of 404 (Not Found)” error in my Chrome developper tools. It seems the problem really comes from finding the path to the javascript file.