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 wp_ulike_custom_shortcode_attachment(){ | |
global $wp_ulike_user_profile_id; | |
$post__in = wp_ulike_get_popular_items_ids(array( | |
'type' => 'post', | |
'rel_type' => 'attachment', | |
'status' => array( 'like', 'dislike' ), | |
'period' => 'all', |
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( 'wp_ulike_permission_status', function( $status, $args , $settings ){ | |
if( ! empty( $args['prev_status'] ) ){ | |
return false; | |
} | |
return $status; | |
}, 10, 3 ); |
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 | |
/** | |
* Display like button inside comment options section | |
*/ | |
add_action( 'bp_activity_comment_options', function(){ | |
echo wp_ulike_buddypress('put'); | |
}, 15 ); | |
/** |
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 wp_ulike_custom_count_logs( $atts ){ | |
// Global variable | |
global $wpdb; | |
// Default Args | |
$args = shortcode_atts( array( | |
"status" => 'like', | |
"type" => 'post' |
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 wp_ulike_pro_custom_enqueue_recaptcha( $status, $target_page ){ | |
// Set your custom pages by id, slug, or title | |
if( is_page( array( 42, 'about-me', 'Contact' ) ) ){ | |
return true; | |
} | |
return false; |
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 text/html before button | |
add_action( 'wp_ulike_before_template', function(){ | |
echo sprintf( '<span>%s</span>', __( 'Like me', 'wp-ulike' ) ); | |
} ); | |
// Add text/html after button | |
add_action( 'wp_ulike_after_template', function(){ |
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( 'rest_api_init', function () { | |
register_rest_field( 'comment', 'votes', array( | |
'get_callback' => function( $comment_arr ) { | |
return array( | |
'like_amount' => wp_ulike_get_comment_likes( $comment_arr['id'], 'like' ), | |
'dislike_amount' => wp_ulike_get_comment_likes( $comment_arr['id'], 'dislike' ), | |
'likers_list' => wp_ulike_get_likers_list_per_post( 'ulike_comments', 'comment_id', $comment_arr['id'], NULL ) | |
); |
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 | |
/** | |
* Process submitted form args | |
* | |
* @param array $args | |
* @return void | |
*/ | |
function wp_ulike_pro_custom_after_profile_process( $args ){ | |
// Get current user 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
<?php | |
function wp_ulike_custom_bp_activity_entry_content() { | |
global $activities_template; | |
if( ! empty( $activities_template->activity->component ) && $activities_template->activity->component === 'groups' ){ | |
if( ! empty( $activities_template->activity->item_id ) && in_array( $activities_template->activity->item_id, array( '1' ) ) ){ | |
echo wp_ulike_buddypress('put'); | |
} | |
} |
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 wp_ulike_custom_content_filter( $button, $content ){ | |
if ( in_the_loop() && is_main_query() && is_page( array( 'terms-of-service', 'privacy-policy', 'contact', 'about' ) ) ){ | |
return $content; | |
} | |
return $button; | |
} | |
add_filter( 'wp_ulike_the_content', 'wp_ulike_custom_content_filter', 2, 10 ); |