How to load on top area of scripts in header with thematic??

Home Forums Using Thematic Child Themes Build Your Own Custom Child Themes How to load on top area of scripts in header with thematic??

This topic is: resolved

This topic contains 5 replies, has 2 voices, and was last updated by  kouen 5 years, 11 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #3293


    Hello i need to load firstly jquery scripts via google libraries.

    i found this piece of code on internet

    if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
    function my_jquery_enqueue() {
    wp_register_script(‘jquery’, "http" . ($_SERVER[‘SERVER_PORT’] == 443 ? "s" : "") . "://", false, null);



    and this one

    // load nivo slider script

    function snix_add_nivo_scripts() {
     ‘jquery’, ‘3.2’);
    add_action(‘init’,’ snix_add_nivo_scripts’);

    my problem is how does i uniform the hooks???
    one is for qp_enqueue_scripts, and the other is for init…
    how should i proceed to have just one target for both hooks… ,
    and eventually makes the stack order how i want it??
    just change the init to wp_enqueue scripts???

    it seems it works, at least i have animations.
    but i want to know… is it right my way??
    if anyone can help me i will appreciate it!
    Thanks in advance for the help.



    Scott Nix

    A couple things…

    It is considered very bad practice to use a jQuery version other than what is bundled with WordPress. There are a ton of reasons not to do it, either way don’t. More info ->

    The example you provide (from me) is actually a really old one, I should probably update it but haven’t used nivo slider in ages. You can see a more updated example of how I do things (loading scripts) on one of my themes. More info ->

    Last but not least, if you want even more supporting references for script loading, this is a very good article ->

    So in short, it is easiest to make one “script manager” that handles all the loading across the theme, as far as priority of order, I am pretty sure that is handled by the order they are enqueued which again helps to have them all in one spot.



    Thanks a lot Scott for the quick reply. its good to know what best practices defines . its of good help that suggestion too… i didnt know that.





    can i ask you which slider r u using now??? i just know anythingslider and nivo slider.

    i hope its free jquery based.

    and yes indeed i downloaded the code from your personal gist at github, sorry i didnt mentioned earlier.

    Salutations Kouen.


    Scott Nix

    The slider I am using now is Flexslider by WooThemes ->

    Really the only reason I use it is because it was one of the first big ones made to handle responsive design, selecting a slider is a pain, they all have certain limitations, not to mention there are a lot of WordPress plugins that may be better suited. For example building a whole admin interface where a client can easily change what is featured on the slider can take up a lot of time where a plugin would already provide that for you. However if you have a slider that grabs a few of the most recent posts to showcase them, then you could easily build that in without and admin interface.

    I can’t really recommend any good WP slider plugins though, there are so many and latetly I have not been using them as they are so popular it has become kind of uncool and gimmicky, not to mention they have drawbacks, taking up valuable space, pushing content down, loading big images (site speed), they don’t always translate well to responsive design, etc… There are articles that dive into this more



    thanks scott for the quick reply  and the information  interesting post krogsgard and really nice i have another question if i would start a thematic child theme is it a good way to start copying the child theme embedded on thematic and starting from that point as a base improving it … or starting from scratch .. i have this question because i downloaded happy theme repository in which the author (  krogsgard    ) starts from revision 0 with a lot of files s. taken from the main theme i dont remember well the base theme he uses now but red the articles about how to starting themes. in this instnce i am starting from scratch but i think it would be better to start from the child theme embedded that gives you an idea about the hooks and triggers that comes with the theme like css classes by default and some basic functions

    and then researching how is it done the pogramming behind thming.

    salutations and thanks again.






Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘How to load on top area of scripts in header with thematic??’ is closed to new replies.