Skip to content

Instantly share code, notes, and snippets.

View MartinL83's full-sized avatar
🤷‍♂️
wat

Martin Lindgren MartinL83

🤷‍♂️
wat
View GitHub Profile
// function to be executed when a custom post type is published
function run_when_post_published()
{
// your function code here
}
// replace {custom_post_type_name} with the name of your post type
add_action('new_to_publish_{custom_post_type_name}', 'run_when_post_published');
add_action('draft_to_publish_{custom_post_type_name}', 'run_when_post_published');
add_action('pending_to_publish_{custom_post_type_name}', 'run_when_post_published');
@MartinL83
MartinL83 / gist:3787343
Created September 26, 2012 11:01
Buddypress custom posts on activity stream.
/*
** Put this in your ( for example ) functions.php file.
** Credits
** http://pastebin.com/qrfjCat8
** http://premium.wpmudev.org/forums/topic/how-to-add-custom-posts-types-in-buddypress-activity
*/
function custom_record_activity( $post_id, $post, $user_id = false ) {
global $bp, $wpdb;