Coder Social home page Coder Social logo

tommcfarlin / wordpress-settings-sandbox Goto Github PK

View Code? Open in Web Editor NEW
259.0 27.0 68.0 206 KB

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

Home Page: http://wp.tutsplus.com/series/the-complete-guide-to-the-wordpress-settings-api/

PHP 95.02% CSS 4.98%

wordpress-settings-sandbox's Introduction

WordPress Settings Sandbox

Summary

A simple WordPress Theme used to demonstrate the WordPress Settings API and related functions. Companion project to this series of articles.

  1. What It Is, Why It Matters
  2. Sections, Fields, and Settings
  3. All About Menus
  4. On Theme Options
  5. Tabbed Navigation For Your Settings Page
  6. Menu Pages.
  7. Validation, Sanitization, and Input I
  8. Validation, Sanitization, and Input II

Checkout

You can always checkout the latest version at this URL.

Install

If you're interested in downloading and installing this theme:

  1. Download the the latest release
  2. Install using the WordPress install process

Additional Notes

  • This theme is intended purely for demonstrating the Settings API and related functions. This should not be used as a foundation for other work or as a theme for blogging, content management, etc.
  • Feel free to submit any pull requests, though I'll likely decline them - this theme is closely aligned with content in this series and is likely written as-is for a specific reason.

Changelog

1.3 (Febuary 3rd, 2013)

  • Fixed a minor typo that was causing a PHP memory time out error for one of the options.

1.2 (January 16th, 2013)

  • Fixing some minor offset errors in the index template

1.1 (December 18th, 2012)

  • Providing default values for the options
  • Minor style updates for the admin panel
  • Added a theme screenshot

1.0 (November 25th, 2012)

  • Updating the README
  • Linking to the final two articles
  • Tagging the example code as final since the series has completed
  • Accepting localization changes

0.7 (April 20, 2012)

  • Updating the README
  • Introducing a few new features for the upcoming article
  • Closing Issue 1
  • Closing Issue 2

0.6 (April 9, 2012)

  • Implementing top-level and submenu functionality
  • Adding README

0.5 (March 26, 2012)

  • Improved coding conventions
  • Implemented tabbed navigation
  • Adding an author's note
  • Adding comments to the sanitize function
  • Adding the sanitize callback

0.2 (March 6, 2012)

  • Completing introduction of new options, social network integration, etc.
  • Moving all of the options to the new theme options page
  • Removing functions for plugin menu

0.1 (February 9, 2012)

  • Initial commit

wordpress-settings-sandbox's People

Contributors

grappler avatar tommcfarlin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wordpress-settings-sandbox's Issues

Why reapply filter?

On line 175 It applies sandbox_theme_default_display_options filter when there are no display options. Then on line 144, why does it re-apply the filter again?

First settings section doesn't save

Using Wordpress 3.3.1

The display options section doesn't actually save...

Did some playing around, it definitely has something to do with > 1 sections on the same page

Uninitialized string offset

when wp-debug is enabled the following error is displayed in display options checkboxes:

Uninitialized string offset: 0 in /path to my settings file/

sandbox_theme_intialize_social_options not found

Crash on fairly stock 3.5.1, running on local host. Crash happens immediately after activating the theme.

Fatal error: Call to undefined function sandbox_theme_default_social_option() in /home/amama/public_html/wordpress/wp-content/themes/WordPress-Settings-Sandbox/functions.php on line 238
Call Stack

Time Memory Function Location

1 0.0007 184824 {main}( ) ../themes.php:0
2 0.0011 219796 require_once( '/home/amama/public_html/wordpress/wp-admin/admin.php' ) ../themes.php:10
3 0.1777 9976280 do_action( ) ../admin.php:111
4 0.1794 9983396 call_user_func_array ( ) ../plugin.php:406
5 0.1794 9983412 sandbox_theme_intialize_social_options( )

Default Settings

Hey Tom,

Regarding setting defaults for settings, what do you feel is the best way? I ended up using something like this (with the Settings Sandbox):

function namespace_option( $key ) {

    $namespace_options = get_option( 'namespace_options' );

     /* Define the array of defaults */ 
    $defaults = array(
        'option_1'     => 1,
        'option_2'     => 0,
        'option_3'    => 'fade'
    );

    $namespace_options = wp_parse_args( $namespace_options, $defaults );

    if( isset($namespace_options[$key]) )
         return $namespace_options[$key];

    return false;
}

So then I'd use <?php echo namespace_option( 'option_1' ); ?> to output an option's value.

Any preferred/better way?

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.