I am launching Christmas pages across 8 different websites which share almost the same code. What is the best way to distribute this?

The files include:

  • christmas page
  • style.css
  • swipbox.js

At the moment, if I make a change in one of the files, i'd need to make it in all of them.

Would you advise creating a plugin for this?... suggestions?

  • You know it's August, right?
    – vancoder
    Aug 24 '16 at 20:07

You can bundle the files into a plugin.

For the Christmas page, you could use the page_template filter - This question gives you an example on how to use it - Create custom page templates with plugins?

For the CSS/JS file, you can add them using the wp_enqueue_scripts action, as you would normally use in a theme. The only difference is that you'll need to use plugin_dir_url() to link to the target files.

Finally, for updating the plugins easily, there are a bunch of libraries like this one which allows you to have the one click updates for your plugins like you normally have for plugins hosted in the WordPress repositories.

  • Thanks! I think what i'll do is create a plugin to generate a unique page and use a custom template for that page.
    – jake
    Aug 24 '16 at 10:39
  • With plguins, Is it possible to create a custom page and use the standard file formatting of page-mypage.php as the template for this page? and keep all the files within the plugin folder?
    – jake
    Aug 24 '16 at 11:11
  • Yes it is possible, plugins like Woocommerce do that. You gotta research how it's done though.
    – RRikesh
    Aug 24 '16 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.