Skip to content

Instantly share code, notes, and snippets.

<?php
spl_autoload_register( function( $class_or_function_name ) {
if ( 'Hydra\\Payment_Gateway_Core' === $class_or_function_name ) {
include_once './class-hydra-payment-gateway-core.php';
}
} );
@RadoslavGeorgiev
RadoslavGeorgiev / functions.php
Last active March 1, 2016 14:54
Theme Options with UF (example)
<?php
add_action( 'uf.setup', function(){
$page = UF_Container_Options_Page::factory( __( 'Theme Options', 'td' ) )
->set_icon( get_bloginfo( 'template_url' ) . '/assets/images/logo.png' )
->set_position( 98 );
# Add fields to the page
$general_fields = array(
UF_Field::factory( 'image_select', 'st_color_scheme', __( 'Color Scheme', 'td' ) )
->add_options(array(
/**
* The structure below is a JavaScript/JSON object,
* which describes the fields of a list/options page.
*
* **IMPORTANT:**
* This code is formatted as JavaScript because JSON does
* not support comments. If all comments get stripped, the content
* that is left will be a well-formatted JSON format.
*
* The main difference between a JavaScript object and the JSON format
@RadoslavGeorgiev
RadoslavGeorgiev / field.js
Created March 30, 2014 10:04
Sample Field
(function($){
$( document ).on( 'uf_extend', function(){
Field.extend( 'Email', {
// Initial constructor
initialize: function() {
// If you wanted to add extra functionality to the input, it would be here.
}
});
});