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 | |
$args = array( | |
'post_type' => 'attachment', | |
'post_mime_type' => 'application/pdf,application/msword', | |
'numberposts' => -1, | |
'post_status' => null, | |
'post_parent' => $post->ID, | |
'orderby' => 'menu_order', | |
'order' => 'ASC' | |
); |
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 | |
/** | |
* Hide Plugin Update Messages for this plugin | |
*/ | |
add_filter( 'http_request_args', 'hide_plugin_update_messages', 10, 2 ); | |
function hide_plugin_update_messages( $r, $url ) { | |
if ( 0 === strpos( $url, 'http://api.wordpress.org/plugins/update-check/' ) ) { | |
$my_plugin = plugin_basename( __FILE__ ); | |
$plugins = unserialize( $r['body']['plugins'] ); |
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 | |
/** | |
* This example shows how to filter the 'This product has sold out.' text. | |
* If the translation domain is 'wpsc' it will replace the text with 'This product is no longer available.'. | |
*/ | |
add_filter( 'gettext', 'my_gettext_filter' ); | |
function my_gettext_filter( $translated_text, $text, $domain ) { | |
if ( 'wpsc' == $domain ) { | |
switch ( $text ) { |
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 | |
/** | |
* Fix canonical for posts in multiple categories | |
*/ | |
class CanonicalCategoryFix { | |
function CanonicalCategoryFix() { | |
add_filter( 'wpseo_canonical', array( $this, 'canonical_permalink' ) ); | |
add_filter( 'wpsc_change_canonical_url', array( $this, 'canonical_permalink' ) ); |
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
/** | |
* Don't try to show TIFF thumbnails in admin | |
*/ | |
function my_wp_prepare_attachment_for_js( $response, $attachment, $meta ) { | |
if ( is_admin() && $response['type'] == 'image' && in_array( $response['subtype'], array( 'tiff', 'tif' ) ) ) { | |
$response['type'] = 'application'; | |
} | |
return $response; | |
} | |
add_filter( 'wp_prepare_attachment_for_js', 'my_wp_prepare_attachment_for_js', 10, 3 ); |
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
Index: users2csv.php | |
=================================================================== | |
--- users2csv.php (revision 277117) | |
+++ users2csv.php (working copy) | |
@@ -26,7 +26,7 @@ | |
if ( is_admin() ) { | |
- if ($_GET['page'] == "users2csv.php") { | |
+ if ( isset( $_GET['page'] ) && $_GET['page'] == 'users2csv.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
/** | |
* Multiple Post Thumbnails (plugin compatibility) | |
* http://wordpress.org/extend/plugins/multiple-post-thumbnails/ | |
*/ | |
if ( class_exists( 'MultiPostThumbnails' ) ) { | |
$types = array( 'page' ); | |
foreach ( $types as $type ) { | |
new MultiPostThumbnails( array( | |
'label' => _x( 'Background Image', 'admin', 'mytheme' ), | |
'id' => 'background-image', |
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(".clickable-block").click(function(){ | |
window.location = jQuery(this).find('a').attr('href'); | |
return 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 | |
/** | |
* Post Order | |
*/ | |
function product_orderby( $query ) { | |
if ( $query->is_main_query() && ( is_post_type_archive( 'custom_post_type_name' ) ) ) { | |
$query->set( 'order', 'ASC' ); | |
$query->set( 'orderby','menu_order' ); | |
} |
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
var ipad_version = 0; | |
window.ondevicemotion = function(event) { | |
if (navigator.platform.indexOf("iPad") != -1) { | |
ipad_version = 1; | |
if (event.acceleration) ipad_version += window.devicePixelRatio; | |
} | |
window.ondevicemotion = null; | |
get_ipad_version(); | |
} |