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 get_post_id() { | |
global $post, $buddypress_post_id; | |
$buddypress_post_id = $post->ID; | |
} | |
add_action( 'wp', 'get_post_id', 1 ); | |
function my_custom_stuff( $content ) { | |
if ( function_exists( 'is_buddypress' ) && is_buddypress() ) { | |
global $buddypress_post_id, $post; | |
$post->ID = $buddypress_post_id; |
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 custom_activity_action($action) { | |
$user_id = bp_get_activity_user_id(); | |
$user_link = bp_core_get_userlink( $user_id ); | |
$activity_timestamp = bp_insert_activity_meta(); | |
if ($activity_type=='YOUR ACTIVITY TYPE HERE i.e activity_update'){ | |
$action = sprintf( __( '%s posted a snippet %2$s', 'buddypress' ), $user_link, $activity_timestamp ); |
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 | |
global $activities_template; | |
$atname = isset( $activities_template->activity->user_login ) ? '@' . $activities_template->activity->user_login : ''; | |
$time = isset( $activities_template->activity->date_recorded ) ? strtotime( $activities_template->activity->date_recorded ) : ''; | |
$human_time = $time ? sprintf( __( '%1$s Ago', 'clp' ), ucwords( human_time_diff( $time ) ) ) : ''; | |
?> | |
<span class="username"><?php echo esc_html( $atname ); ?></span> | |
<span class="arrow-separator"></span> | |
<span class="time"><?php echo esc_html( $human_time ); ?></span> |
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 | |
/** | |
* Part Name: Facet WP Sitewide Search | |
* Description: Handles the FacetWP + SearchWP stuff | |
* Areas: before_content | |
*/ | |
/** | |
* Note that customizations to this template should be done | |
* using filters. |
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 | |
/** | |
* Plugin Name: BP Add Page | |
* Plugin URI: https://webdevstudios.com | |
* Description: Example on adding a page to BuddyPress profiles | |
* Author: WebDevStudios | |
* Author URI: https://webdevstudios.com | |
* Version: 1.0.0 | |
* License: GPLv2 | |
*/ |
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 bp_custom_email_message() { | |
// Create post object | |
$my_post = array( | |
'post_title' => __( '[{{{site.name}}}] New post comment.', 'buddypress' ), | |
'post_content' => __( '{{commenter.name}} commented on your blog post.', 'buddypress' ), | |
'post_status' => 'publish', | |
'post_type' => bp_get_email_post_type() // this is the post type for emails | |
); |
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 | |
/* | |
Plugin Name: WDS CLP Update Forum Group Meta Script | |
Description: Updates the group meta for forum id based on updated forum ids. | |
Author: WebDevStudios | |
Author URI: http://webdevstudios.com | |
Version: 1.0 | |
License: GPL2 | |
*/ |
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 edd_has_purchased_variation( $download_slug = '', $price_id = '' ) { | |
$current_user_info = wp_get_current_user(); | |
$has_puchased = false; | |
$download = edd_get_download( $download_slug ); | |
$purchases = edd_get_users_purchases( $current_user_info->user_email, 100, false, 'any' ); | |
if ( $purchases ) { | |
foreach ( $purchases as $purchase ) { |
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
home_url() //> http://example.com | |
get_stylesheet_directory_uri() //> http://example.com/wp-content/themes/THEME_NAME [same: get_bloginfo('template_url') ] | |
get_stylesheet_directory() //> /home/www/wp-content/themes/THEME_NAME | |
plugin_dir_url(__FILE__) //> http://example.com/wp-content/plugins/MY-PLUGIN/ [while used inside plugin.. same as: plugins_url('',__FILE__) ] | |
plugin_dir_path(__FILE__) //> /home/www/wp-content/plugins/MY-PLUGIN/ [while used inside plugin] |
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 filter_class( $classes, $box ) { | |
foreach ( $box as $key => $value ) { | |
if ( isset( $box->meta_box['attributes'] ) && isset( $box->meta_box['attributes']['classes'] ) ) { | |
if ( ! empty( $box->meta_box['attributes']['classes'] ) ) { | |
$classes[] = $box->meta_box['attributes']['classes']; | |
} | |
} | |
} |