Skip to content

Instantly share code, notes, and snippets.

@dovy
dovy / gist:5892179
Created June 29, 2013 18:38
Example module.
<?php
/*
* The header core options for the Shoestrap theme
*/
if ( !function_exists( 'shoestrap_module_header_options' ) ) {
function shoestrap_module_header_options() {
/*-----------------------------------------------------------------------------------*/
/* The Options Array */
@dovy
dovy / module.php
Created June 29, 2013 18:39
Shows module functions used by new SMOF.
<?php
/*
* The header core options for the Shoestrap theme
*/
if ( !function_exists( 'shoestrap_module_header_options' ) ) {
function shoestrap_module_header_options() {
/*-----------------------------------------------------------------------------------*/
/* The Options Array */
array(
'id' => 'presets', //must be unique
'type' => 'images',
'presets' => true,
'title' => __('Preset', 'simple-options'),
'sub_desc'=> __('Select a background pattern.', 'simple-options'),
'std' => 0,
'options' => array(
'1' => array('alt' => '1 Column', 'img' => SOF_OPTIONS_URL.'img/1col.png', 'presets'=>array('slider2'=>12,'patterns'=>2)),
'2' => array('alt' => '2 Column Left', 'img' => SOF_OPTIONS_URL.'img/2cl.png', 'presets'=>'{"slider2":"30", "patterns":"5"}'),
@dovy
dovy / Options Folding
Last active December 22, 2015 13:28
Example folding for the Redux Framework.
<?php
array(
'id'=>'switch-custom',
'type' => 'switch',
'title' => __('Switch - Custom Titles', 'redux-framework'),
'subtitle'=> __('Look, it\'s on! Also hidden child elements!', 'redux-framework'),
"default" => 0,
'on' => 'Enabled',
'off' => 'Disabled',
),
@dovy
dovy / Redux-required-arg-exampes.php
Last active March 4, 2021 14:16
Example of the required attribute for the Redux Framework.
<?php
$options = array(
'required' => array('id','equals',array( 1,3 ) ) // Multiple values
);
$options = array(
'required' => array('id','equals', array( 1 ) ) // Single value
);
@dovy
dovy / addAndOverridePanelCSS.php
Last active December 22, 2015 16:49
Showing you how to add to or override the Redux CSS values.
<?php
function addAndOverridePanelCSS() {
wp_dequeue_style( 'redux-css' );
wp_register_style(
'redux-custom-css',
'http://urltomyfile',
array( 'farbtastic' ), // Notice redux-css is removed and the wordpress standard farbtastic is included instead
time(),
'all'
);
<?php
if(!class_exists('ReduxFramework')){
require_once(dirname(__FILE__) . '/ReduxFramework/framework.php');
}
<?php
$field = array(
'id'=>'header-border',
'type' => 'border',
'title' => __('Header Border Option', 'redux-framework'),
'subtitle' => __('Only color validation can be done on this field type', 'redux-framework'),
'desc' => __('This is the description field, again good for additional info.', 'redux-framework'),
'default' => array('color' => '#1e73be', 'style' => 'solid', 'width'=>'3')
),
<?
$field = array(
'id'=>'18',
'type' => 'button_set',
'title' => __('Button Set Option', 'redux-framework'),
'subtitle' => __('No validation can be done on this field type', 'redux-framework'),
'desc' => __('This is the description field, again good for additional info.', 'redux-framework'),
'options' => array('1' => 'Opt 1','2' => 'Opt 2','3' => 'Opt 3'), //Must provide key => value pairs
'default' => '2'
);
<?
// YOUR OLD VERSION
array(
'id'=>'typography',
'type' => 'typography',
'title' => __('Typography', 'redux-framework'),
'subtitle'=> __('Typography option with each property can be called individually.', 'redux-framework'),
'default'=> array(
'color'=>"#333",