Git Product home page Git Product logo

page-template-example's Introduction

Page Template Example

An example WordPress plugin used to show how to include templates with your plugins and programmatically add them to the active theme.

You can read more about this plugin and how it works in this blog post.

How It Works

The plugin works like this:

  1. Upon activation, it checks to see if a template with the same filename exists within the active theme's root directory.
  2. If so, the plugin will not do anything; however, if no template file exists, then it will create the template in the root of the active theme.
  3. Upon deactivation, the template will be removed from the active theme directory.

Installation

Using The WordPress Dashboard

  1. Navigate to the 'Add New' Plugin Dashboard
  2. Select page-template-example.zip from your computer
  3. Upload
  4. Activate the plugin on the WordPress Plugin Dashboard

Using FTP

  1. Extract page-template-dashboard.zip to your computer
  2. Upload the page-template-dashboard directory to your wp-content/plugins directory
  3. Activate the plugin on the WordPress Plugins Dashboard

Known Issues

Because this plugin is used strictly for example purposes, there are a number of things that are not properly handled:

  • If the user changes a theme, the plugin does not move the template to the new theme's directory.
  • There's practically no error handling for the file operations.
  • If a template with the same file name already exists, there's no notification or error handling in this case so the user has no idea that the bundled template was not activsated.
  • â€ĻI'm sure there are more.

This particular plugin is tagged as 0.1 and is open to any and all pull requests to help make this better, so feel free to contribute to resolve any of the above issues or any that you experience.

Changelog

0.1

7 March 2013

  • Initial release

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.