Last active
July 22, 2022 18:00
-
-
Save chellestein/2f60a665e8c07c62a747 to your computer and use it in GitHub Desktop.
Add Favorite Posts to Ultimate Member User Profile Tabs in WordPress
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 | |
// Customize Profile Tabs | |
/* add a custom tab to show user pages */ | |
add_filter('um_profile_tabs', 'pages_tab', 1000 ); | |
function pages_tab( $tabs ) { | |
$tabs['pages'] = array( | |
'name' => 'Favorite Posts', | |
'icon' => 'um-faicon-star', | |
'custom' => true | |
); | |
return $tabs; | |
} | |
/* Tell the tab what to display */ | |
add_action('um_profile_content_pages_default', 'um_profile_content_pages_default'); | |
function um_profile_content_pages_default( $args ) { | |
global $ultimatemember; ?> | |
<?php echo do_shortcode('[user_favorites user_id="" include_links="true" post_types="post" include_buttons="false"]'); ?> | |
<?php | |
} |
Hi. Where i need to put this code so it will work? Which file? Thanks. I have both plugins. I want to active favorites in ultimate member.
I will be waiting for answer. Please.
Hi Michelle, can you tell where to apply this code please?
Sorry I just saw these comments now lol...In case someone should stumble across this with the same questions: Code Snippets Plugin is the easiest method - https://wordpress.org/plugins/code-snippets/ - make sure you leave out the <?php opening tag.
Also, this is a VERY old snippet posted in 2015, so not sure if it still works or even relevant with the current version of the plugin.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is to be used with the following plugins:
https://wordpress.org/plugins/ultimate-member/
https://wordpress.org/plugins/favorites/