Skip to content

Geczy/WP-Simple-Settings-Framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WP Simple Settings Framework

A minimalistic framework for Wordpress Settings API.

Quick start

Installation

  1. Include the framework in your Wordpress plugin by using:

    <?php
    add_action( 'init', 'sf_load_settings' );
    function sf_load_settings() {
    	require 'classes/sf-class-settings.php';
    	$settings_framework = new SF_Settings_API($id = 'my_plugin_name', $title = 'My Plugin Title', $menu = 'plugins.php', __FILE__);
    	$settings_framework->load_options('path-to-sf_options.php');
    }

    Optionally, you might want to make $settings_framework a global variable so that you can use the helper functions.

  2. Open sf-options.php to begin configuring your options.

Features

Automatic settings page

Don't want it under the Plugins tab like in the screenshot? No problem, you can choose where you want it!

You can also change "Simple Settings" submenu to be anything you'd like.

settings page example


Tooltips

tooltips example

Optional tooltips using Twitter Bootstrap!


Select box replacement

select box replacement

Utilizing Select2 to display select boxes. It's pretty cool!


Multiple tabs

multiple tabs example

Create multiple tabs for your options.


Input types

  • Text
  • Number
  • Textarea
  • Checkbox
  • Radio
  • Select
  • WP Pages

Helpers

Update or add a new option

<?php
$settings_framework->update_option('your_option', 'new_value');

Get an existing option's value

<?php
$settings_framework->get_option('your_option');

Example configuration

Check out the example config for an idea of how to use every input type.

Here's an example of one type, though:

<?php
$options[] = array(
	'name' => __( 'Name', 'geczy' ),
	'desc' => __( 'Please tell me who you are.', 'geczy' ),
	'id'   => 'text_sample',
	'type' => 'text',
);

Bug tracker

Have a bug? Please create an issue here on GitHub!

https://github.com/Geczy/WP-Simple-Settings-Framework/issues/

Copyright and License

Copyright 2012 Matthew Gates

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the names of the copyright holders nor the names of the contributors may be used to endorse or promote products derived from this software without specific prior written permission.

http://www.opensource.org/licenses/bsd-license.php

About

A simple framework for Wordpress' Settings API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •