Bit of a odd question. I want to be able to host example simple websites on my Wordpress Site. These "simple" sites would just consist of client side code.

Is there a way to create a page which just uses these files, possible a plugin I am unaware of?

Thank you.

  • question is unclear. add more details. If you want to create stack html pages you can just put them on the wordpress directory and they will load when you visit them.. – Sisir Feb 17 '15 at 8:35

I've done this in the past by using custom page templates.

Basically, there are two ways to create a custom page template.

  1. You can create a file in your themes directory and name it page-vanilla-html.php.

  2. You can create a file and name it whatever you want (for example vanilla-html.php). You just need to include a template description at the top of the file:

     * Template Name: A Vanilla HTML/CSS/JS Custom Page Template
     * Description: This template is nothing but vanilla HTML/CSS/JS!

Once you've created the custom template, you simply create a new page within Wordpress. If the name of the page is "Vanilla HTML" it will search for a file named page-vanilla-html.php and load it automatically. If you used the second method, you can select the template from the drop down on the right side of the page creation screen.

|improve this answer|||||
  • Quick aside, while it will probably work to just put the <script> tags in the template, you're still better off using wp_enqueue_script to add the js for these templates. You can add conditional code within the callback function to only load the js when that template is loaded. – Andrew Bartel Feb 17 '15 at 18:57
  • Ah execallent, I can then probably just create a few custom fields to auto load the data nicely into the file! – jackdh Feb 17 '15 at 23:04
  • @AndrewBartel Enqueueing the script in this case is not a good idea. These are HTML/CSS/JS files - which implies PHP won't be used (except for the comment on top). This means no wp_header() or wp_footer(), and no enqueued scripts. – Radley Sustaire Feb 18 '15 at 20:46
  • 1
    Ah, good point @RadGH. And you're in Eugene too, that's cool! – Andrew Bartel Feb 18 '15 at 21:57

Create a directory named (for example) example in the root directory of your domain (where the WordPress index.php lives).

In that directory you can create your "simple" sites. So if you create a HTML document named mysite.htm and visit yourdomain.com/example/mysite.htm the browser should display that page.

This is the default webserver behaviour - no need for a plugin.

|improve this answer|||||
  • Yeah I was thinking that was what I was going to need to do, I was wondering if there was a way to do this within the control panel. – jackdh Feb 17 '15 at 16:48
  • Yes, use Page Templates as mentioned in this answer. – Andrew Bartel Feb 17 '15 at 18:55

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.