ThemeShaper Forums » Thematic

[closed]

Re-order Head items so Style Sheet call is last

(2 posts)
  • Started 3 years ago by wlanni
  • Latest reply from wlanni
  • This topic is not resolved
  1. wlanni
    Member

    Hello!

    I'm trying to filter (or hook?) the header so that the thematic_create_stylesheet() call is after wp_head().

    At the moment I just have header.php copied into my childtheme with everything re-ordered. Seems like the simplest fix. However, I'd love to know how to do this using either a filter or a hook (or is that appropriate?)?

    I attempted using an add_filter:
    function my_styles_first() {
    //move the hook for my style to the last
    // Creating the doctype
    thematic_create_doctype();
    echo " ";
    language_attributes();
    echo ">\n";

    // Creating the head profile
    thematic_head_profile();

    // Creating the doc title
    thematic_doctitle();

    // Creating the content type
    thematic_create_contenttype();

    // Creating the description
    thematic_show_description();

    // Creating the robots tags
    thematic_show_robots();

    // Creating the canonical URL
    thematic_canonical_url();

    if (THEMATIC_COMPATIBLE_FEEDLINKS) {
    // Creating the internal RSS links
    thematic_show_rss();

    // Creating the comments RSS links
    thematic_show_commentsrss();
    }

    // Creating the pingback adress
    thematic_show_pingback();

    // Enables comment threading
    thematic_show_commentreply();

    // Calling WordPress' header action hook
    wp_head();

    // Loading the stylesheet
    thematic_create_stylesheet();
    }
    add_filter( 'get_header', 'my_styles_first' );

    Then I attempted to unhook the thematic_create_stylesheet completely so I could add it after wp_head... but I wasn't sure how I'd do that either. Anyway, this didn't work so I gave up:
    function unhook_stylesheet_position() {
    //remove custom style sheet
    remove_action('get_header','thematic_create_stylesheet');
    }

    add_action('init','unhook_stylesheet_position');

    Posted 3 years ago #
  2. wlanni
    Member

    I should note that the reason for this is to make overriding plugin style sheets easier. If my style sheet shows up after wp_head(), then any plugin style sheets come before mine and I don't have to style with !important

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.