Skip to content

Instantly share code, notes, and snippets.

View Alimir's full-sized avatar
👀
looking for purest...

Ali Mirzaei Alimir

👀
looking for purest...
View GitHub Profile
@Alimir
Alimir / wp-ulike-pro.php
Created March 16, 2022 13:39
Disaply modal after voting
<?php
add_filter( 'wp_ulike_pro_init_modal_after_success', function( $content, $data ){
ob_start();
echo "Thank You!";
return ob_get_clean();
}, 10 , 2 );
@Alimir
Alimir / wp-ulike-pro.php
Created March 8, 2022 15:05
sort posts by likes in archive pages
<?php
function wp_ulike_pro_custom_pre_archive($query) {
/* only proceed on the front end */
if( is_admin() ) {
return;
}
if ( ( is_category() || is_tag() || is_archive() ) && $query->is_main_query() ) {
@Alimir
Alimir / wp-ulike-pro.php
Last active December 11, 2023 14:36
add custom fields to register form
<?php
function wp_ulike_pro_custom_after_signup_process( &$args ){
// Get current user id
$meta_args = array();
$meta_args['phone'] = ! empty( $_POST['phone'] ) ? $_POST['phone'] : null;
$meta_args['user-role'] = ! empty( $_POST['user-role'] ) ? array( $_POST['user-role'] ) : null;
foreach ($meta_args as $key => $value) {
update_user_meta( $args->data['user_id'], $key, $value );
@Alimir
Alimir / wp-ulike.php
Created December 3, 2021 09:19
provide the wp ulike with the HTTP request header that contains the real visitor IP
<?php
/**
* Add a custom HTTP request header to fix IP address detection
* @param \Geminilabs\Vectorface\Whip $whip
* @return void
*/
add_action('wp_ulike_whip_action', function ($whip) {
$customHeader = 'HTTP_X_SUCURI_CLIENTIP'; // change the header as needed
$whip->addCustomHeader($customHeader);
});
@Alimir
Alimir / buddyboss.php
Last active March 14, 2022 09:02
Display like buttons in buddyboss activites + comments
<?php
// Use this hook to disable default buddyboss like button:
add_filter( 'bp_is_activity_like_active', '__return_false' );
@Alimir
Alimir / wp-ulike-pro.css
Created November 11, 2021 22:48
Change wp ulike clapping template colors
:root {
--clapping-custom-primary-color: #bdc3c7;
--clapping-custom-secondary-color: #ff6d6f;
--clapping-custom-dot-color: rgba(149, 165, 166, 0.5);
--clapping-custom-triangle-color: rgba(211, 84, 0, 0.5);
--clapping-custom-shockwave-color: #fc573b;
}
.wpulike.wpulike-clapping .wp_ulike_btn {
border-color: var(--clapping-custom-primary-color);
@Alimir
Alimir / wp-ulike-pro.css
Last active November 1, 2021 17:37
Sample voting template with inline SVG icon (only for pro version)
<style>
.wpulike-custom-pro-template .wp_ulike_btn {
background: none;
padding: 0;
width: auto;
height: auto;
}
.wpulike-custom-pro-template .wp_ulike_btn:hover, .wpulike-custom-pro-template .wp_ulike_btn:focus {
color: black;
background-color: transparent;
@Alimir
Alimir / wp-ulike-pro.php
Created October 26, 2021 13:14
Redirect bbPress profiles to WP ULike profile builder
<?php
function wp_ulike_get_user_profile_url( $user_id = 0 ){
return wp_ulike_pro_get_user_profile_permalink( $user_id );
}
add_filter( 'bbp_pre_get_user_profile_url', 'wp_ulike_get_user_profile_url' );
add_filter( 'bbp_pre_get_user_topics_created_url', 'wp_ulike_get_user_profile_url' );
add_filter( 'bbp_pre_get_user_replies_created_url', 'wp_ulike_get_user_profile_url' );
add_filter( 'bbp_pre_get_user_engagements_url', 'wp_ulike_get_user_profile_url' );
@Alimir
Alimir / wp-ulike-pro.php
Created September 29, 2021 08:54
Get top posts based on like_amount meta field
<?php
function wp_ulike_pro_custom_top_posts($atts){
$args = array(
'post_type' => 'post',
'orderby' => array( 'meta_value_num' => 'DESC') ,
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'like_amount',
@Alimir
Alimir / wp-ulike.php
Created September 1, 2021 12:45
Hide wp ulike menu bubble notifications
<?php
add_filter( 'wp_ulike_display_admin_new_likes', '__return_false' );