Created
November 20, 2020 09:23
-
-
Save MjHead/c68c01f2f6cd2a50aadea13e492b26b2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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( 'edit_user_profile', 'my_user_likes' ); | |
add_action( 'show_user_profile', 'my_user_likes' ); | |
function my_user_likes( $user ) { | |
// user-meta-store you need to replace with your actual Data Store slug | |
$liked = get_user_meta( $user->ID, 'je_data_store_user-meta-store', true ); | |
echo '<h2>User Likes</h2>'; | |
if ( ! $liked ) { | |
echo 'No likes'; | |
} else { | |
foreach ( $liked as $post_id ) { | |
printf( '<a href="%1$s">%2$s</a><br>', get_permalink( $post_id ), get_the_title( $post_id ) ); | |
} | |
echo '<br><br>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment