Tag Archives: hook

Send email on saving post type using hook

functions.php


add_action( 'save_post', 'my_project_updated_send_emails' );
function my_project_updated_send_emails(){
if( get_post_type() == 'birs_client' ){
wp_mail('ravi.loyalweb@gmail.com','subject ok 5','message ok 5');
}
}

Post by custom days without array

This is under plugins function

http://wordpress.stackexchange.com/questions/54142/check-post-date-in-pre-get-posts

query_posts(array(
‘post_type’ => ‘movies’,
‘event_categories’ => $spot_category,
‘posts_per_page’ => -1
));

Now i add in functions.php using hook

http://devotepress.com/wordpress-coding/when-to-use-pre_get_posts-in-wordpress/#.VO8EaTWli1G

function popular_posts_weekly_custom($query) {
if (function_exists(‘vh_spotlight’)){
$today = getdate();
$query->set( ‘orderby’, ‘comment_count’);
$query->set( ‘day’, $today[‘mday’] );
}
}
add_action( ‘pre_get_posts’, ‘popular_posts_weekly_custom’ );

%d bloggers like this: