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( 'shortcode_atts_gallery', 'sheri_galleries_default_to_four_columns', 10, 3 ); | |
function sheri_galleries_default_to_four_columns( $atts, $defaults, $raw_atts ) { | |
// Don't override manually-set number of columns | |
if ( ! empty( $raw_atts['columns'] ) ) { | |
return $atts; | |
} |
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 | |
/** | |
* Copy paste the below code into your theme's functions.php file. | |
* You could add it to a plugin instead, but it's just easier to | |
* add it to your theme's functions.php. The only drawback to this | |
* is if you switch themes, this functionality will stop working. | |
* | |
* --Alex Mills | |
* Questions? Contact me: http://www.viper007bond.com/contact/ |
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 | |
class Your_Media_List_Table extends WP_Media_List_Table { | |
/* some stuff here */ | |
// Adds a WHERE modify filter, calls parent version of prepare_items(), then removes filter | |
function prepare_items() { | |
add_filter( 'posts_where', array( &$this, 'modify_post_status_to_private' ) ); |
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 | |
# See bigdawggi's comment below for a good combined example | |
// Pre-3.3 | |
function cf_google_search_kill_wp_search( $where, $query ) { | |
global $wp_the_query; | |
if( ! is_admin() && $query->is_search() && $query === $wp_the_query ) { | |
$where = ' AND 1=0'; |
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_action( 'pre_get_posts', 'oomskaap_price_range_limiter' ); | |
function oomskaap_price_range_limiter( $query ) { | |
// Only do something if both the start and end values are set in the URL | |
if ( empty( $_GET['pricestart'] ) || empty( $_GET['priceend'] ) ) | |
return; | |
// Only modify the main query |
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
// File Settings - User | |
{ | |
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", | |
"font_face": "Consolas", // Windows, you'll likely want default or something else | |
"font_size": 10, | |
//"spell_check": true, |
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 | |
# Stick this file in your wp-content folder | |
define( 'WP_INSTALLING', true ); | |
require_once( dirname( __FILE__ ) . '/../wp-load.php' ); | |
timer_start(); | |
require_once( ABSPATH . 'wp-admin/includes/upgrade.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 | |
/** | |
* Takes posts that are in category A and also adds them to category B | |
*/ | |
// Uncomment this to proceed | |
exit( "You need to edit the file and enter the hostname and category IDs.\n" ); | |
// What blog? Asking for both for safety reasons. |
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_action( 'pre_get_posts', 'localtv_posts_and_pages_for_search' ); | |
function localtv_posts_and_pages_for_search( $query ) { | |
if ( $query->is_main_query() && $query->is_search() ) | |
$query->set( 'post_type', array( 'post', 'page' ) ); | |
} |
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 | |
// floatvalue() ended up working best most of the time, with only a few exceptions | |
error_reporting(E_ERROR | E_WARNING | E_PARSE); | |
$floatvals = array( | |
'1,337.01', | |
'1,337', | |
'1337.01', |
OlderNewer