• This repository has been archived on 14/Sep/2019
  • Stars
    star
    229
  • Rank 173,562 (Top 4 %)
  • Language
    PHP
  • License
    GNU General Publi...
  • Created over 11 years ago
  • Updated almost 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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

License

The Page Template Example is licensed under the GPL v2 or later.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Known Issues

For information about changes related to the project, be sure to review the ChangeLog.

1.0.0 (26 October 2013)

The templating mechanism has changed drastically in 1.0.0. In order to add templates to your theme using this plugin, you must do the following:

  1. Review Lines 91 - 94 in class-page-templates.php.
  2. Notice that we're defining templates in an associative array - the example templates exist in the templates directory.

To implement your own template, you must:

  1. Add the template to the templates directory
  2. Update the associated array to include the key/value pair necessary for updating the page attribute dropdown.

0.1.0 (7 March 2013)

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.0 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.

Author Information

Page Template Example originally started and is maintained by Tom McFarlin, but is constantly under development thanks to the contributions from other WordPress developers.

More Repositories

1

WordPress-Widget-Boilerplate

[WordPress] The WordPress Widget Boilerplate is an organized, maintainable boilerplate for building widgets using WordPress best practices.
PHP
1,016
star
2

WordPress-Settings-Sandbox

[WordPress-Envato] A simple theme used to showcase the WordPress Settings API. The corresponding series of articles will run on Envato's TutsPlus Network.
PHP
259
star
3

phpcs-wpcs-vscode

How to install PHP CodeSniffer and the WordPress Coding Standard Rules in Visual Studio Code.
191
star
4

konami-code

[jQuery] Using the Konami code, easily configure and Easter Egg for your page or any element on the page.
JavaScript
139
star
5

simple-autoloader-for-wordpress

An autoloader that aims to be as simple as dropping it into your WordPress project. All you need is a well-organized project.
PHP
89
star
6

theme-customizer-example

[WordPress-Envato] This theme is used to demonstrate how to integrate the Theme Customizer into a WordPress theme. It's an example project used in a WPTuts+ series of articles.
PHP
89
star
7

single-post-meta-manager

[WordPress] A plugin for displaying a given post's meta data within the single post view of editing a post.
PHP
56
star
8

Simple-Overlay

[Retired-jQuery] A Plugin For Lightweight, Flexible, and Customizable Overlays. This plugin is no longer maintained.
JavaScript
54
star
9

wp-plugin-scaffold

A simple scaffold used for what's needed to spin up a Composer-based WordPress plugin.
PHP
47
star
10

title-capitalization-for-wordpress

[WordPress] Properly capitalizes post titles and heading elements in the post content when saving and updating posts.
PHP
46
star
11

wp-gist

Adds support for GitHub Gist embeds to WordPress.
JavaScript
43
star
12

Basic-Theme

[Retired-WordPress-Envato] A simple theme used to demonstrate how to introduce unit testing into WordPress theme development.
PHP
38
star
13

toggle-admin-notices

Hide all admin notices, warnings, and errors in the WordPress admin area using an option in the admin bar.
PHP
37
star
14

markdown-code-for-wordpress

[WordPress] A simple WordPress plugin for replacing backticks with `code` tags in the content of posts, pages, and other post types.
PHP
33
star
15

page-template-info

[WordPress] This plugin displays the name of the template associated with each page on the 'All Posts' page.
PHP
29
star
16

page-template-dashboard

An easy way to see which templates your pages are using without having to view the page editor.
PHP
27
star
17

Hello-Reader

[Retired-WordPress-Envato] A simple WordPress plugin used to demonstrate unit testing in the context of WordPress projects.
PHP
23
star
18

namespaces-and-autoloading-in-wordpress

[WordPress] A simple example of namespaces an autoloading used to demonstrate the concepts in a presentation at WordCamp Atlanta 2017.
PHP
22
star
19

Collapsible-Menus

[Retired-jQuery] Collapsible Menus is a plugin that makes it easy to create collapsible menus using nested, unordered lists.
JavaScript
20
star
20

WordPress-Custom-Menu-Separator

[WordPress] A simple plugin for demonstrating how to add a custom menu separator in the WordPress administration menu.
PHP
19
star
21

wp-remote-post-example

[Retired-WordPress-Envato] An example plugin demonstrating how to use wp_remote_post.
PHP
17
star
22

remove-empty-shortcodes

Removes the Restrict Content Pro shortcode from your content.
PHP
15
star
23

wp-simple-ajax

[Envato] A simple demo for how to use Ajax in WordPress. The repository will ultimately contain two tags - one for a procedural approach to the plugin, one for an object-oriented approach to the plugin.
PHP
15
star
24

ajax-notification

[Retired-WordPress-Envato] An example plugin used to demonstrate the WordPress Ajax API for a companion article on Envato's WPTuts+ site.
PHP
14
star
25

WordPress-Upload-Meta-Box

[WordPress] An example plugin for how to include a metabox for attaching files to your WordPress posts outside of the media uploader.
PHP
14
star
26

generic-custom-post-type

Creates a generic post type to be used for testing other plugins that rely on them.
PHP
14
star
27

My-Social-Networks

[Retired-WordPress-Envato] An simple plugin demonstrating how to write maintainable WordPress widgets.
PHP
14
star
28

simple-factory-example

[Retired-WordPress-Envato] An example of how to use the Simple Factory design pattern.
PHP
11
star
29

Redactor-Image-Upload-For-WordPress

[WordPress] A script that aims to make it easy to integrate image uploads with the Redactor.js WYSIWYG editor into any WordPress based project.
PHP
10
star
30

ive-read-this

[Retired-WordPress-Envato] A simple plugin used to demonstrate how to use Ajax on the frontend of WordPress
PHP
10
star
31

Post-Author-Credit

[Retired-WordPress] A simple plugin used to demonstrate how to use Ajax in WordPress development. Includes fully documented and localized code following WordPress coding conventions. This plugin is no longer maintained.
PHP
10
star
32

WordPress-jQuery-Date-Picker

[Retired-WordPress-Envato] An example plugin for how to include the jQuery date picker into the WordPress post dashboard.
PHP
9
star
33

remove-public-pingbacks

Removes the count and listing of pingbacks from the public-facing side of a WordPress site.
PHP
9
star
34

gURLDemo

[Retired] A simple demonstration of how to use the Google URL shortener API in your own web-based projects. This plugin is no longer maintained.
PHP
9
star
35

tags-without-links

[WordPress] This plugin makes it easier for developers to display tags without any links associated with them.
PHP
8
star
36

tm-callback-info

Renders contextual information about every function registered with all WordPress hooks.
PHP
8
star
37

add-custom-view

A WordPress plugin that demonstrates how to add custom views to the Edit Page.
PHP
7
star
38

jquery-get-input-type

[jQuery] A simple plugin used for getting any given input element's type.
JavaScript
7
star
39

Top-Commenters-Cached

[Retired-WordPress-Envato] A plugin used to demonstrate the WordPress Transients API for an Envato blog series. This plugin is no longer maintained.
PHP
7
star
40

RSS-Note

[Retired-WordPress-Envato] A plugin used to demonstrate how to write maintainable plugins. This plugin is no longer maintained.
PHP
6
star
41

three-recent-posts

An example project that goes from rapid-application-development to a full-fledged plugin for WordPress.
PHP
6
star
42

wp-env-reader-drop-in

A drop-in utility for WordPress projects that reads information from a `.env` file to make testing and simulating easier.
4
star
43

custom-metadata-filter

Adds a custom filter for viewing posts with headline metadata.
4
star
44

category-sticky-post

Mark a post to be displayed – or stuck – to the top of the archive page for the specified category.
4
star
45

cmb2-featured-mobile-image

Select an image to display as your featured image in the mobile version of your site.
PHP
4
star
46

acme-company

[WordPress] An example for how to use interfaces and inheritance with the WordPress Settings API.
PHP
3
star
47

wp-dracula-highlight-js

A WordPress plugin for adding the Dracula color scheme and Highlight.js to the Block Editor.
PHP
3
star
48

wp-hello-world

An example plugin for a membership course walking readers through how to work with GitHub.
PHP
3
star
49

disable-all-comments

Disables all WordPress comments while also allowing you to turn them back on at a per-post level.
PHP
2
star
50

custom-comment-emails

[Retired-Envato] A plugin used to demonstrate how to create custom comment email notifications. The corresponding series of articles will run on Envato's TutsPlus Network.
PHP
2
star
51

backcast

An application used to backup podcast subscriptions via XML export files.
1
star
52

subtitles-migration

Migrates old theme subtitles to compatibility with the Subtitles plugin.
PHP
1
star
53

ray-for-wordpress

An example project for how to use Spatie Ray in WordPress Development.
PHP
1
star
54

wp-template-view

Easily see what custom templates your pages and custom post types are using from the WordPress administration area.
1
star