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 FB_Like_Widget extends WP_Widget { | |
| private static $scripts_added; | |
| public function __construct() { | |
| parent::__construct( | |
| 'fb-like-box-widget', // ID | |
| 'Facebook Widget ', // Name | |
| array( |
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
| ;(function($) { | |
| $.fn.extend({ | |
| stickyWidget: function(options) { | |
| // Exit if there are no elements to avoid errors: | |
| if (this.length === 0) { | |
| return this; | |
| } | |
| var settings = $.extend({ |
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
| function nh_trim_post_titles($format) { | |
| return '%s'; | |
| } | |
| add_filter('protected_title_format', 'nh_trim_post_titles' ); | |
| add_filter('private_title_format', 'nh_trim_post_titles' ); |
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 | |
| /** | |
| * Clear oEmbed Cache on save | |
| * this is necessary in order to update the oembed output | |
| */ | |
| function nh_clear_oembed_caches($post_id) { | |
| if ( wp_is_post_revision( $post_id ) ) return; | |
| global $wp_embed; | |
| $wp_embed->delete_oembed_caches($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
| Header set X-UA-Compatible "IE=edge" |
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
| // Cleanup some of the extra menu item classes added to wp_nav_menu | |
| function nh_allowed_menu_item_classes($classes, $item) { | |
| // Get custom classes added from within the menus admin page | |
| $new_classes = (array) get_post_meta( $item->ID, '_menu_item_classes', true ); | |
| // Consolidate the assorted "current..." classes | |
| $current_classes = preg_grep('/current/', $classes); | |
| if(!empty($current_classes)) $new_classes[] = 'current'; |
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
| Array.prototype.shuffle = function() { | |
| var i = this.length, j, temp; | |
| if ( i === 0 ) return this; | |
| while ( --i ) { | |
| j = Math.floor( Math.random() * ( i + 1 ) ); | |
| temp = this[i]; | |
| this[i] = this[j]; | |
| this[j] = temp; | |
| } | |
| return this; |
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
| function new_embed_sizes() { | |
| return array( 'width' => 640, 'height' => 9999); | |
| } | |
| add_filter('embed_defaults', 'new_embed_sizes'); |
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
| function cleanup_post_class( $classes, $class, $post_id ) { | |
| foreach($classes as $key => $class): | |
| if(preg_match('/(^tag)|(^post)|(hentry)|(uncategorized)|(status)/', $class)) unset($classes[$key]); | |
| endforeach; | |
| $classes[] = 'post-'.$post_id; | |
| return $classes; | |
| } | |
| add_filter('post_class', 'cleanup_post_class', 10 , 3); |
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 | |
| // Custom Post Type Dropdown | |
| function cmb_post_type_dropdown($field, $meta) { | |
| wp_dropdown_pages(array( | |
| 'show_option_none' => '-- Select One ---', | |
| 'name' => $field['id'], | |
| 'id' => $field['id'], | |
| 'post_type' => $field['post_type'], | |
| 'selected' => $meta | |
| )); |