View gist:4711952
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' ); |
View gist:4711970
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' ) | |
) ); | |
} |
View postLoadImages
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(); |
View gist:5210667
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 ) { |
View utm_tracking
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.fn.utm_tracking = function(domain, source, medium, campaign) { | |
$(this).find('a[href^="' + domain + '"]').each(function() { | |
var url = $(this).attr('href'); | |
$(this).attr( 'href', url + '?utm_source=' + source + '&utm_medium=' + medium + '&utm_campaign=' + campaign ); | |
}); | |
} | |
// Example Call | |
$(document).ready( function() { | |
$('body').utm_tracking('http://www.example.com','example_source','example_link','example_campaign'); |
View gist:884d6abe92857a329d99
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 add_custom_options_page() { | |
$menu = $this->menu_settings(); | |
switch( $menu['mode'] ) { | |
case 'menu': | |
// http://codex.wordpress.org/Function_Reference/add_menu_page | |
$this->options_screen = add_menu_page( | |
$menu['page_title'], |
View custom_edd_sl_license_response
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
/** | |
* This code requires one additional filter param to be added to edd_sl_license_response in EDD_Software_Licensing.php: | |
* $response = apply_filters( 'edd_sl_license_response', $params, $download, $data) | |
*/ | |
/** | |
* Allows EDD to bypass the name check for files | |
*/ | |
define( 'EDD_BYPASS_NAME_CHECK', true ); |
View edd-csv-purchase-import.php
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 | |
/* | |
Plugin Name: Easy Digital Downloads - CSV Purchase Import | |
Plugin URL: http://easydigitaldownloads.com/extension/csv-purchase-import | |
Description: Allows you to import purchase history CSVs from other ecommerce systems | |
Version: 0.1 | |
Author: Pippin Williamson | |
Author URI: http://pippinsplugins.com | |
Contributors: mordauk | |
*/ |
View customizer-controls-40
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_customizer_register( $wp_customize ) { | |
$wp_customize->add_panel( 'panel_id', array( | |
'priority' => 10, | |
'capability' => 'edit_theme_options', | |
'theme_supports' => '', | |
'title' => __( 'Example Panel', 'textdomain' ), | |
'description' => __( 'Description of what this panel does.', 'textdomain' ), | |
) ); |
View gist:a4bc9bf08d27be51e29e
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
/** | |
* Load custom post type archive on home page | |
* | |
* Reference: http://www.wpaustralia.org/wordpress-forums/topic/pre_get_posts-and-is_front_page/ | |
* Reference: http://wordpress.stackexchange.com/questions/30851/how-to-use-a-custom-post-type-archive-as-front-page | |
*/ | |
function prefix_downloads_front_page( $query ) { | |
// Only filter the main query on the front-end | |
if ( is_admin() || ! $query->is_main_query() ) { |
OlderNewer