This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Duplicate the sanitize_hex_color function, which is generally | |
* only available to the theme customizer. | |
*/ | |
if ( !function_exists( 'sanitize_hex_color' ) ) { | |
function sanitize_hex_color( $color ) { | |
if ( '' === $color ) | |
return ''; | |
// 3 or 6 hex digits, or the empty string. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Script Name: Zendesk API Command Line | |
* Description: Run directly from the command line using "php -f zendesk-api.php $query". | |
* Version: 1.0.0 | |
* Author: Devin Price | |
*/ | |
// Credentials not stored in version control, request in order to run script | |
$id = 'user@example.com'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prefix_service_conversion_tracking( $order_id ) { | |
// Lets grab the order | |
$order = new WC_Order( $order_id ); | |
// Products | |
$products = $order->get_items(); | |
?> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function prefix_enqueue_custom_script(){ | |
wp_register_script( 'prefix_custom_script', plugin_dir_url( __FILE__ ) .'js/custom-script.js', array( 'jquery' ) ); | |
wp_enqueue_script( 'prefix_custom_script' ); | |
wp_localize_script( 'prefix_custom_script', 'optionsframework', array( | |
'hello' => __( 'Hello', 'textdomain' ), | |
'goodbye' => __( 'Good Bye', 'textdomain' ) | |
) ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Add a checkbox to the featured image metabox */ | |
add_filter( 'admin_post_thumbnail_html', 'theme_featured_image_meta'); | |
function theme_featured_image_meta( $content ) { | |
global $post; | |
// Text for checkbox | |
$text = __( "Don't display image on post.", 'textdomain' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// jQuery Plugin for post loading images | |
$.fn.postLoadImages = function(callback) { | |
var imgLen = this.length, | |
count = 0; | |
return this.each(function(count) { | |
count++; | |
if ($(this).attr('data-src')) { | |
var imgTag = this, imgSrc = $(this).attr('data-src'); | |
i = new Image(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function oenology_add_menu_parent_class( $items ) { | |
$parents = array(); | |
foreach ( $items as $item ) { | |
if ( $item->menu_item_parent && $item->menu_item_parent > 0 ) { | |
$parents[] = $item->menu_item_parent; | |
} | |
} | |
foreach ( $items as $item ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Allows visitors to log in using e-mail address | |
* | |
* @param string username passed by reference | |
*/ | |
function prefix_authenticate_by_email( &$username ) { | |
$user = get_user_by( 'email', $username ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Theme Update Script | |
* | |
* Runs if version number saved in theme_mod "version" doesn't match current theme version. | |
*/ | |
function prefix_update_check() { | |
$ver = get_theme_mod( 'version', false ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Get pages set in the customizer (if any) | |
$pages = array(); | |
for ( $count = 1; $count <= 5; $count++ ) { | |
$mod = get_theme_mod( 'showcase-page-' . $count ); | |
if ( 'page-none-selected' != $mod ) { | |
$pages[] = $mod; | |
} | |
} |