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 sort_posts( $posts, $orderby, $order = 'ASC', $unique = true ) { | |
if ( ! is_array( $posts ) ) { | |
return false; | |
} | |
usort( $posts, array( new Sort_Posts( $orderby, $order ), 'sort' ) ); | |
// use post ids as the array keys | |
if ( $unique && count( $posts ) ) { |
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 | |
/** | |
* Basic URL Signing functions for WordPress. | |
* | |
* @author Brady Vercher (twitter.com/bradyvercher) | |
* @link http://www.blazersix.com/blog/protect-your-products-and-improve-your-systems-with-signed-urls/ | |
*/ | |
/** | |
* Sign a URL to ensure it hasn't been tampered with. |
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 | |
/** | |
* WordPress template tag to allow for CSS classes to be easily filtered across templates. | |
* | |
* @author Brady Vercher (twitter.com/bradyvercher) | |
* @link http://www.blazersix.com/blog/wordpress-class-template-tag/ | |
* | |
* @param string $id Element identifier. | |
* @param array|string $classes Optional. List of default classes as an array or space-separated string. | |
* @param array|string $args Optional. Override defaults. |
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_filter( 'wp_nav_menu_objects', 'blazersix_nav_menu_classes', 10, 2 ); | |
/** | |
* Add helpful nav menu item classes. | |
* | |
* Adds class hooks to various nav menu items since child pseudo selectors | |
* aren't supported in all browsers. | |
*/ | |
function blazersix_nav_menu_classes( $items, $args ) { |
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_filter( 'pre_option_thumbnail_crop', 'themename_default_image_options' ); | |
add_filter( 'pre_option_thumbnail_size_h', 'themename_default_image_options' ); | |
add_filter( 'pre_option_thumbnail_size_w', 'themename_default_image_options' ); | |
add_filter( 'pre_option_medium_size_h', 'themename_default_image_options' ); | |
add_filter( 'pre_option_medium_size_w', 'themename_default_image_options' ); | |
add_filter( 'pre_option_large_size_h', 'themename_default_image_options' ); | |
add_filter( 'pre_option_large_size_w', 'themename_default_image_options' ); | |
function themename_default_image_options( $value ) { |
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: Installed Plugin Details | |
* Description: Show a "Details" link for installed plugins to view information from the WordPress.org plugin directory. | |
* Version: 1.0.0 | |
* Author: Blazer Six | |
* Author URI: http://www.blazersix.com/ | |
* License: GPL-2.0+ | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
* |
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 | |
/** | |
* Search for a post type. | |
* | |
* <code>-cpt:{post_type} {query}</code> | |
*/ | |
function bils_cpt_search( $results, $args ) { | |
$search_args = array( | |
'post_status' => 'any', | |
'post_type' => $args['modifier'][1], |
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 | |
/** | |
* Search for posts in a category. | |
* | |
* <code>-categ:{category slug} {query}</code> | |
*/ | |
function bils_category_search( $results, $args ) { | |
$post_types = get_post_types( array( 'public' => true ), 'objects' ); | |
$search_args = array( |
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
/** | |
* Bind event listeners with optional debounce and throttle modes. | |
* | |
* @param {object} el The object to bind an event to. | |
* @param {string} eventType The type of event to listen for. | |
* @param {object} handler The callback handler. | |
* @param {object} options Options to modify behavior. | |
* - delay: Time in milliseconds. Behavior depends on mode. | |
* - init: Whether the handler should be called when registered. Default is false. | |
* - mode: 'debounce' or 'throttle'. Default is 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 | |
/** | |
* Plugin Name: Infinite WP List Tables | |
* Description: Infinite scroll support for WP List Tables in the WordPress admin panel. | |
* Version: 0.1.0 | |
* Author: Brady Vercher | |
* Author URI: http://www.blazersix.com/ | |
* License: GPL-2.0+ | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
*/ |
OlderNewer