Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added cache busting support #14

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

SteelWagstaff
Copy link

Added version numbers with last modified date references to enqueued css and js files

wp-h5p-xapi.php Outdated
@@ -19,10 +19,10 @@

function h5pxapi_enqueue_scripts()
{
wp_register_script("wp-h5p-xapi", plugins_url() . "/wp-h5p-xapi/wp-h5p-xapi.js", array("jquery"));
wp_register_script("wp-h5p-xapi", plugins_url() . "/wp-h5p-xapi/wp-h5p-xapi.js", array("jquery"), filemtime(), true);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SteelWagstaff filemtime() needs to reference a file, so (as per the example in your issue) it should be something like:

- wp_register_script("wp-h5p-xapi", plugins_url() . "/wp-h5p-xapi/wp-h5p-xapi.js", array("jquery"), filemtime(), true);
+ wp_register_script("wp-h5p-xapi", plugins_url() . "/wp-h5p-xapi/wp-h5p-xapi.js", array("jquery"), filemtime( __FILE__ ), true);

Copy link

@greatislander greatislander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SteelWagstaff This PR won't work as is, see comments re: filemtime().

wp-h5p-xapi.php Outdated
wp_enqueue_script("wp-h5p-xapi");

wp_register_style("wp-h5p-xapi", plugins_url() . "/wp-h5p-xapi/wp-h5p-xapi.css");
wp_register_style("wp-h5p-xapi", plugins_url() . "/wp-h5p-xapi/wp-h5p-xapi.css", array(), filemtime(), 'all');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants