• Resolved w3dgie

    (@w3dgie)


    Okay, so under appearance, editor, in header.php there is a portion that says <?php wp_head(); ?>.

    I am trying to go through the code on all my pages and uniquely organize my code so it appears pretty. For example, I want to keep all of the meta tags together and all of the link tags together all the style tags together and all the script tags together.

    How would I go about controlling the order these tags are displayed in the header from my plugin files?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter w3dgie

    (@w3dgie)

    bump

    [stop bumping – against forum rules – 2 deleted]

    Get ride of <?php wp_head(); ?> and then manually enter all your metadata, plugin calls, javascripts, etc., in all your template files. And realize that you’re going to break lots of stuff until you get it all correct.

    I’m in the same boat…

    Are you saying that if a theme designer used “<?php wp_head(); ?>” then the specifications for that are somewhere in functions.php?

    I can’t find anything in functions.php that looks like metadata or header code. Is there any speed advantage to not using “<?php wp_head(); ?>”?

    Are you saying that if a theme designer used “<?php wp_head(); ?>” then the specifications for that are somewhere in functions.php?

    wp_head is a hook.

    if you want to see just what core stuff depends on it, look inside wp-includes/default-filters.php

    add_action(‘wp_head’, ‘wp_enqueue_scripts’, 1);
    add_action(‘wp_head’, ‘feed_links_extra’, 3);
    add_action(‘wp_head’, ‘rsd_link’);
    add_action(‘wp_head’, ‘wlwmanifest_link’);
    add_action(‘wp_head’, ‘index_rel_link’);
    add_action(‘wp_head’, ‘parent_post_rel_link’, 10, 0);
    add_action(‘wp_head’, ‘start_post_rel_link’, 10, 0);
    add_action(‘wp_head’, ‘adjacent_posts_rel_link’, 10, 0);
    add_action(‘wp_head’, ‘locale_stylesheet’);
    add_action(‘wp_head’, ‘noindex’, 1);
    add_action(‘wp_head’, ‘wp_print_styles’, 8);
    add_action(‘wp_head’, ‘wp_print_head_scripts’, 9);
    add_action(‘wp_head’, ‘wp_generator’);

    additionally, plugins use it.

    you can create your own similar hook and move stuff around.

    Thats what Ive done..

    Sorry, what is a “hook” ? Where can I learn about this stuff? Isn’t there just a default explanation for the HTML that that variable spits out when it’s called?

    got google?

    https://www.google.com/#hl=en&source=hp&q=wordpress+hooks&aq=0p&aqi=g-p3g7&oq=wordpress&fp=fceeb2705a2dd16

    Isn’t there just a default explanation for the HTML that that variable spits out when it’s called?

    No, because its not always the same. read back where I said plugins use it.

    Do you use the same plugins as me? I doubt it.

    Its done the way it is because its actually simpler that way.

    Any of the above can be removed from wp_head by commenting out the corresponding line, with no effect on the others. And if you want to know what they all do, go get a copy of wingrep, download the zip, unpack it, and search for those strings.

    In version 2.9.2

    // Actions
    add_action('wp_head','wp_enqueue_scripts',1);
    add_action('wp_head','feed_links_extra',3);
    add_action('wp_head','rsd_link');
    add_action('wp_head','wlwmanifest_link');
    add_action('wp_head','index_rel_link');
    add_action('wp_head','parent_post_rel_link',10, 0 );
    add_action('wp_head','start_post_rel_link',10, 0 );
    add_action('wp_head','adjacent_posts_rel_link', 10, 0 );
    add_action('wp_head','locale_stylesheet');
    add_action('wp_head','noindex',1);
    add_action('wp_head','wp_print_styles',8);
    add_action('wp_head','wp_print_head_scripts',9);
    add_action('wp_head','wp_generator');
    add_action('wp_head','rel_canonical');

    And to exclude them (I left the real useful ones):

    remove_action('wp_head','wp_enqueue_scripts');
    remove_action('wp_head','feed_links_extra');
    remove_action('wp_head','rsd_link');
    remove_action('wp_head','wlwmanifest_link');
    remove_action('wp_head','index_rel_link');
    remove_action('wp_head','parent_post_rel_link');
    //remove_action('wp_head','start_post_rel_link');
    remove_action('wp_head','adjacent_posts_rel_link');
    //remove_action('wp_head','locale_stylesheet');
    remove_action('wp_head','noindex');
    //remove_action('wp_head','wp_print_styles');
    //remove_action('wp_head','wp_print_head_scripts');
    remove_action('wp_head','wp_generator');
    remove_action('wp_head','rel_canonical');

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘wp_head(); Question!!’ is closed to new replies.