This file contains hidden or 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 | |
/* | |
Place in functions.php or custom plugin | |
example usage | |
$options[] = array( | |
'name' => __('Bid Text Page', 'options_framework_theme'), | |
'desc' => __('The bid page', 'options_framework_theme'), | |
'id' => 'header-bid-cta-page', | |
'type' => 'page_select'); | |
?> |
This file contains hidden or 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 | |
//Tested by adding to functions.php - Should work in a custom plugin though | |
class opubco_reader_edit { | |
public function __construct() { | |
add_action( 'admin_head-options-reading.php', array( $this, 'init' ) ); | |
} | |
public function init() { | |
add_filter( 'wp_dropdown_pages', array( 'opubco_reader_edit', 'add_edit_links' ) ); | |
} |
This file contains hidden or 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 | |
/*Place in functions.php or in custom plugin | |
Creates an overlay over the YouTube iFrame and allows you to pop-up the YouTube URL into a lightbox | |
*/ | |
add_filter( 'embed_oembed_html', 'opubco_youtube_parse', 10, 4 ); | |
function opubco_youtube_parse( $html, $url, $attr, $post_ID ) { | |
//Works well with: http://www.wonderplugin.com/wordpress-lightbox/ | |
if ( strstr( $url, 'youtu' ) ) { | |
if ( preg_match( '/src="([^"]+)"/', $html, $matches ) ) { | |
$embed_url = $matches[ 1 ]; |
This file contains hidden or 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 | |
//Place in mu-plugins folder | |
//Custom Twig Template Functions | |
function opubco_add_twig_functions_and_filters( $registry ) { | |
$loader = $registry->get('theme.loader'); | |
$twig = $loader->get_twig_instance(false, true); | |
$twig->addFunction( new Twig_SimpleFunction('opubco_get_event_avatar', 'opubco_get_event_avatar') ); | |
} | |
add_action( 'ai1ec_loaded', 'opubco_add_twig_functions_and_filters'); |
This file contains hidden or 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_action( 'init', 'opubco_filter_sidebar_widgets_init' ); | |
function opubco_filter_sidebar_widgets_init() { | |
add_filter('widget_display_callback', 'opubco_filter_widget_display_instance', 12, 3); | |
add_filter( 'sidebars_widgets', 'opubco_filter_sidebar_widgets', 15, 1 ); | |
} | |
function opubco_filter_widget_display_instance( $instance, $widget, $args ) { | |
if ( is_home() ) { |
This file contains hidden or 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
if ( function_exists( 'is_product' ) && is_product() ) : | |
global $post; | |
$product = get_product( $post->ID ); | |
if ( $product->is_in_stock() ) { | |
$price = $product->get_price(); | |
} | |
?> | |
<script type="text/javascript"> | |
var google_tag_params = { |
This file contains hidden or 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 | |
class I_Am_Evil { | |
private $times = 0; | |
private $callbacks = array(); | |
private $accepted_args = array(); | |
public function __construct() { | |
} | |
public function load() { | |
global $wp_filter; |
This file contains hidden or 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 | |
//Run in init action | |
//Replace apartments with your post type name | |
//Must use PHP >= 5.3 | |
add_filter( 'manage_apartments_posts_columns', function( $columns ) { | |
$columns['apt_thumb'] = __('Thumb'); | |
return $columns; | |
} ); | |
add_action( 'manage_apartments_posts_custom_column', function( $column_name, $post_id ) { |
This file contains hidden or 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 | |
//Requires PHP >= 5.3 | |
add_filter( 'sce_can_edit', function( $can_edit, $comment_obj, $comment_id, $post_id ) { | |
//Make sure user is logged in | |
if ( !is_user_logged_in() ) { | |
return false; | |
} | |
//Get current user id | |
$user = wp_get_current_user(); |