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', 'filter_posts_list'); | |
function filter_posts_list($query) | |
{ | |
global $pagenow; | |
global $current_user; | |
get_currentuserinfo(); |
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( 'manage_posts_custom_column' , 'custom_columns', 10, 2 ); | |
add_action( 'manage_store_posts_columns' , 'add_store_columns', 10, 2 ); | |
/** | |
** FOR CUSTOM POST TYPE USE: | |
** manage_{$post_type}_posts_custom_column | |
** manage_{$post_type}_posts_columns | |
*/ |
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( 'save_post', 'update_post_title' ); | |
function update_post_title( $post_id ){ | |
global $wpdb; | |
$post_type = get_post_type( $post_id ); | |
$title = ''; | |
if ( $post_type === 'store' ) { | |
$name = get_post_meta( $post_id, 'name', 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 | |
/** notification mail email change. | |
** | |
** @param string $mail Custom e-mail address. | |
**/ | |
add_filter('wp_mail_from','custom_email_from'); | |
function custom_email_from($mail) { | |
$mail = '[YOURMAIL@YOURSITE.COM]'; | |
return $mail; |
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 | |
/** Set a custom from name. | |
** | |
** @param string $name Custom name. | |
*/ | |
add_filter('wp_mail_from_name','custom_email_from_name'); | |
function custom_email_from_name($name) { | |
$name = 'My Site Name'; | |
return $name; |
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 getExcerpt($str, $startPos=0, $maxLength=100) { | |
if(strlen($str) > $maxLength) { | |
$excerpt = substr($str, $startPos, $maxLength-3); | |
$lastSpace = strrpos($excerpt, ' '); | |
$excerpt = substr($excerpt, 0, $lastSpace); | |
$excerpt .= '...'; | |
} else { | |
$excerpt = $str; | |
} |
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_theme_support( 'post-thumbnails' ); | |
add_image_size( 'description-thumbnail', '385', '224' ); | |
add_image_size( 'description-medium', '385', '224' ); | |
add_image_size( 'description-large', '385', '224' ); | |
?> |
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( 'restrict_manage_posts', 'filter_posts_by_topics', 10, 2 ); | |
function filter_posts_by_topics( $post_type, $which ) { | |
/* Apply this only on a specific post type */ | |
if ( 'post' !== $post_type ) { | |
return; | |
} |
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_site_transient_update_core', 'remove_core_updates' ); /* Hide WordPress Core updates */ | |
add_filter( 'pre_site_transient_update_plugins', 'remove_core_updates' ); /* Hide Plugins updates */ | |
add_filter( 'pre_site_transient_update_themes', 'remove_core_updates' ); /* Hide Theme updates */ | |
/* Hide update notifications */ | |
function remove_core_updates(){ | |
global $wp_version; | |
return (object) array( |
OlderNewer