Home

Build themes and plugins faster!
 

GitHub

 

What's so special?

Building options in the backend could not be easier

 

Being able to create options in the backend of Wordpress is key to every project. Being able to do it fast means staying under budget. Being able to do it fast while producing high quality code means happy customers. In a nutshell, we built Premise WP to help you keep your clients happy and cming back!

Quickly create layouts and grids for the front end

 
<div class="pwp-row">
	<div class="col3 pwp-align-center">
		This will create 3 columns
	</div>
	<div class="col3 pwp-align-center">
		All with the same size (1/3 of the row)
	</div>
	<div class="col3 pwp-align-center">
		Using class 'pwp-align-center'
		centers the text
	</div>
</div>

With Premise WP CSS library you can build pretty much any layout very quickly. For example, this code snippet shows how to create a grid with 3 columns per row all with equal witdths. The text in each column will be aligned in the center too!

Built-in jQuery plugins let you do more!

 

Most of the JS functionality that gets added to Premise WP is added as a jQuery plugin. This gives us a lot of flexibility. We can set global defaults for our plugins or set options per instance. You can also extend the plugins to much more. New plugins are constatly added!

Here's an example of a Google Map.

Compare the difference

Check out how much quicker it is to build an options page in the backend of Wordpress using Premise WP.

<?php
// set the fields
$fields = array(
    'action' => 'options.php',
    'name_prefix' => 'my_options_page'
    array(
        'type' => 'text',
        'name' => '[text-field]',
    ),
    array(
        'type' => 'textarea',
        'name' => '[textarea-field]',
    ),
    array(
        'type' => 'wp_media',
        'name' => '[wp_media-field]',
        'multiple' => true,
        'preview' => true,
    ),
    array( 'type' => 'submit', ),
);

// create the admin page
new PWP_Admin_Page( 'My Options Page', $fields, $fields['name_prefix'] );
<?php

// Hook our code to add options page
add_action( 'admin_menu', array( My_Options_Page::get_instance(), 'register_menu_page' ) );

// The class to handle the 
class My_Options_Page {
    
    /**
     * Holds instance of this class
     *
     * @static
     * 
     * @var object
     */
    private static $instance;
 
    /**
     * Main Instance
     * 
     * @static
     * 
     * @return      The one true instance
     */
    public static function get_instance() {
        if ( ! isset( self::$instance ) )
            self::$instance = new self;
        return self::$instance;
    }

    /**
     * Register our menu page
     */
    public function addMyAdminMenu() {
        add_menu_page(
            'My Options Page Title',
            'My Menu Title',
            'manage_options',
            'my-options-page-slug',
            array( $this, 'render_my_admin_page' ),
            '',   // icon
            '2.1' // priority
        );
    }
    
    /**
     * Display the fields that you want to use on your admin page.
     *
     * IMPORTANT: You must consider security measures here. This is not
     * done by WP automatically. It is done by Premise WP tho!
     * 
     * @return string the html for the form for your options page
     */
    public function render_my_admin_page() {
        $fields = array(
            'action' => 'options.php',
            array(
                'type' => 'text',
                'name' => 'my_options_page[text-field]',
            ),
            array(
                'type' => 'textarea',
                'name' => 'my_options_page[textarea-field]',
            ),
            array(
                'type' => 'wp_media',
                'name' => 'my_options_page[wp_media-field]',
                'multiple' => true,
                'preview' => true,
            ),
            array( 'type' => 'submit', ),
        );

        pwp_form( $fields );
    }
}