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 modify_post_mime_types( $post_mime_types ) { | |
// select the mime type, here: 'application/pdf' | |
// then we define an array with the label values | |
$post_mime_types['application/pdf'] = array( __( 'PDFs' ), __( 'Manage PDFs' ), _n_noop( 'PDF <span class="count">(%s)</span>', 'PDFs <span class="count">(%s)</span>' ) ); | |
// then we return the $post_mime_types variable | |
return $post_mime_types; |
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
add_action( 'save_post', 'wptuts_save_thumbnail' ); | |
function wptuts_save_thumbnail( $post_id ) { | |
// Get Thumbnail | |
$post_thumbnail = get_post_meta( $post_id, $key = '_thumbnail_id', $single = true ); | |
// Verify that post is not a revision | |
if ( !wp_is_post_revision( $post_id ) ) { | |
// Check if Thumbnail exists |
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 | |
function getLatandLong($addr,$city,$state) | |
{ | |
global $lat; | |
global $lng; | |
$doc = new DOMDocument(); | |
$doc->load("http://maps.google.com/maps/api/geocode/xml?address=".$addr.",+".$city.",+".$state."&sensor=false"); //input address | |
//traverse the nodes to get to latitude and longitude |
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
/** | |
* Add a rel="nofollow" to the comment reply links | |
*/ | |
function comment_reply_link_nofollow( $link ) { | |
global $user_ID; | |
return str_replace( '")\'>', '")\' rel=\'nofollow\'>', $link ); | |
} | |
add_filter( 'comment_reply_link', 'comment_reply_link_nofollow' ); |
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
//Paste this in function.php | |
add_action( 'save_post', 'wptuts_save_thumbnail' ); | |
function wptuts_save_thumbnail( $post_id ) { | |
// Get Thumbnail | |
$post_thumbnail = get_post_meta( $post_id, $key = '_thumbnail_id', $single = true ); | |
// Verify that post is not a revision | |
if ( !wp_is_post_revision( $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
jQuery.ajax({ | |
url: '/wp-admin/admin-ajax.php', | |
type: 'GET',//POST, JSON, XML | |
dataType: 'html', | |
data: ({ | |
action: 'MY_AJAX_FUNCTION', | |
state: state, | |
}), | |
success: function(data){ | |
if (data){ |
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 | |
define( 'BLOCK_LOAD', true ); | |
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-config.php' ); | |
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-includes/wp-db.php' ); | |
$wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST); |
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
add_filter('body_class','add_mobile_class'); | |
function add_mobile_class($classes) { | |
$classes[] = 'NEW_CLASS'; | |
return $classes; | |
} |
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
add_action('admin_init', 'slt_lock_theme'); | |
function slt_lock_theme() { | |
global $submenu, $userdata; | |
get_currentuserinfo(); | |
if ($userdata->ID != 1) { | |
unset($submenu['themes.php'][5]); | |
unset($submenu['themes.php'][15]); | |
} | |
} |
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 ( !current_user_can( 'edit_users' ) ) { | |
add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 ); | |
add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) ); | |
} |