• I build a custom theme from localhost site using XAMPP and PhpAdmin i added couple Javascripts to get page running and it was working all good.

    Until right after I export entire WP core from local to my site host. , When I returned back to WP admin on local host to take a look on my theme realize it admin is not detecting any javascript or getting my page to work that runs with Javascript.

    Yes, I have added code inside function.php
    add_action(‘wp_enqueue_scripts’,’mytheme_scripts_function’);
    wp_enqueue_script(‘jquery’)
    wp_enqueue_script(‘myjs’, get_template_directory_uri() . ‘/js/myjs.js’);

    Are there any solution or any way to get WP Admin to recongize theme’s Javascript and have it running?

Viewing 4 replies - 1 through 4 (of 4 total)
  • wp_enqueue_scripts is for the frontend if I’m not mistaked…

    I think you would be after
    http://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts

    Thread Starter apratherjr

    (@apratherjr)

    Thanks for replying… I am not sure I get you entirely…

    From my understating… I coded wp_enqueue_script inside function.php in order to get my theme to recognize Javascript. However, I don’t think its problem with my theme… It has to do with WP admin because I tried with several theme that have Javascript coded. none of them are working.

    So more likely WP Admin is the culprit.

    aplogies, I misread your OP, and thought you were looking to brings scripts specifically into the admin side of things.

    http://codex.wordpress.org/Function_Reference/wp_register_script
    possibly register the scrpit prior to enqueue?

    ALso, I see you add_action – mytheme_scripts_function, but I don’t see where you define it… what is inside that function?

    Or did you mean to regsiter and enqueue your scripts within that function?

    Thread Starter apratherjr

    (@apratherjr)

    Here let me rephrase… I have registered and define WP_enqueue in function.php. and here’s the code

    add_action('wp_enqueue_scripts','ALP-scripts_function');
    function ALP-scripts_function() {
            //theme options
    	global $options;
    
    	wp_enqueue_script('jquery');	
    
    	// js
    	wp_enqueue_script('hover', get_template_directory_uri() . '/asset/js/jquery.hoverIntent.minified.js');
    
           	}
    }
    ?>

    But this isn’t problem I am looking at because this code works perfectly on my localhost wordpress admin before I export it to live site.

    When I returning back to localhost wordpress Admin, working on same theme again, the Javascript on theme doesn’t load up, I confirmed by switching another free theme with javascript by other developer. They don’t work either.

    So the culprit is WordPress on localhost that is not detecting or loading javascript at all and I was hoping someone or you know the solution to it?

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘WP Admin isn' recongizing Javascripts’ is closed to new replies.