Giter VIP home page Giter VIP logo

meta-box-boilerplate's Introduction

Meta Box Boilerplate

With this boilerplate plugin, creating new meta boxes for the WordPress backend becomes very easy. All you have to do is creating a new class implementing the meta box base class and write a function to render and one to save the meta box.

Quickstart

In the example-plugin folder you'll find a very simple plugin that uses the boilerplate. It uses the boilerplate plugin as a "helper plugin". So to give it a try, just copy both folders into your wp-content/plugin directory and activate both of them, first the boilderplate, than the example plugin.

Frequently Asked Questions

How can I add my meta box using the boilerplate?

Just write a new PHP class which extends the Meta_Box base class and implements the Meta_Box_Interface. This new new class needs to have two functions: render() and save(). In the constructor of this new class, you call the constructor of the parent class. Here you can define the name, label, post type, position and priority of the new meta box.

Can I use this boilderplate inside of my own plugin or theme?

Absolutely! You don't have to use it as a "helper plugin". The only thing you have to make sure is that the PHP files with the classes can be found. The easiest way to achieve this is using the provided autoloader function from the Meta_Box_Boilerplate class. Just copy this function into your theme or plugin, rename it to something unique like meta_box_boilerplate_autoload and hook it in like so:

spl_autoload_register( 'meta_box_boilerplate_autoload' );

You also have to copy the inc folder into you plugin or theme and copy all of your new meta box implementing classes into this folder. As the function spl_autoload_register and namspaces are used, you need PHP 5.3 or greater, to use it this way.

meta-box-boilerplate's People

Contributors

2ndkauboy avatar

Stargazers

Savaş Uyar avatar David Bisset avatar Luke Cavanagh avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

arsoboy

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.