WordPress.org

Ready to get started?Download WordPress

Ideas

a better way for plugin-developers to add css and javascript?

  1. Frank Goossens
    Member

    12345

    instead of expecting plugin developers to echo their links to external css and js in wp_head, it might make sense to have 2 functions; register_external_css and register_external_javascript?

    both would be similar, only css would be added in the <head>-section and javascript at the end of the html (as performance-geeks consider best practice).

    a 2nd step could be that all css which is registered that way, gets fetched with one call (one css-file containing all registered css) as would be all javascript (again; one js-file containing all registered javascript), that way minimizing the amount of http-calls?

    Posted: 5 years ago #
  2. Frank Goossens
    Member

    12345

    been thinking about this some more;
    * this should not only be used by plugin-developers, but also by theme-wizards (and even by wp-core if applicable?)
    * it could not only be used to declare links to external css or js, but also to dump css- or js-code. so one could do;
    register_css("wp-content/plugins/plugin/plugin.css");
    register_css(".plugin {display:block}");
    and
    register_js("wp-content/plugings/plugin/external.js");
    register_js("alert('js registered ok');");

    Posted: 5 years ago #
  3. Jen Mylo
    Key Master

    Closing thread because a year has passed and it has not received any community comments.

    Posted: 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

  • Rating

    12345
    5 Votes
  • Status

    Sorry, not right now