Giter Site home page Giter Site logo

tommcfarlin / wordpress-settings-sandbox Goto Github PK

View Code? Open in Web Editor NEW
259.0 259.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 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

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( )

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?

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.