Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7073693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:57:36+00:00 2026-05-28T05:57:36+00:00

I’m writing a plugin for WordPress developers that allows a dev to include my

  • 0

I’m writing a plugin for WordPress developers that allows a dev to include my own widgets in their theme at any point.

The issue is that I can’t control when they’re going to require/use the widget code – which itself might necessitate the inclusion of external js/css files.

I think it’s likely that people will call these widgets often after wp_head() has executed, which means that any js/css inclusions that go with the particular widget they’ve called will get added inline (or, into the footer if i write it that way).

I can’t predict beforehand which widgets they might use to make sure the assets are included at an earlier juncture – and as far as i know, i can’t ensure they end up in the [head] short of altering the output buffer with a preg_replace afterwards.

So my question is really two-fold: If you were using the plugin, would you have a problem with potential assets for widgets (like carousels, etc) being loaded inline or in the footer? (I know non-critical js is often loaded in the footer, but have not seen a convention for doing this with css) And if so, is it worth altering the buffer with a preg_replace in order to fix this issue and ensure the externals end up in the [head]? Or perhaps a 3rd option I haven’t thought of?

The widgets themselves can be custom-made so i can’t guarantee that any scripts that go with them aren’t important enough to need to be loaded first (though it’s unlikely) and i’m slightly concerned that altering the buffer after every page load would be inefficient.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:57:36+00:00Added an answer on May 28, 2026 at 5:57 am

    I would make a requirement that your pluggins must be loaded in the template or in the pluggins before wp_head gets called. It is increasingly important to provide well structured code these days so offering a hack through or a way to produce bad code is IMO bad practice.

    Your idea about the replace is nice, it’s not a bad thing at all that could allow late-binding of external scripts, but my suggestion stands. If wordpress requires you to setup your CSS and Plugins and Scripts before the wp-head, why not require it too for your framework…

    Enforcing good standards should never make you lose interest, at least, the real pro community will like it, while the copy/pasters that don’t really understand programming will probably find it frustrating and complex.

    Cheers

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I need a function that will clean a strings' special characters. I do NOT
I am writing an app with both english and french support. The app requests
I'm trying to create an if statement in PHP that prevents a single post
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.