Skip to content

Instantly share code, notes, and snippets.

@chellestein
Last active July 22, 2022 18:00
Show Gist options
  • Save chellestein/2f60a665e8c07c62a747 to your computer and use it in GitHub Desktop.
Save chellestein/2f60a665e8c07c62a747 to your computer and use it in GitHub Desktop.
Add Favorite Posts to Ultimate Member User Profile Tabs in WordPress
<?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
}
@chellestein
Copy link
Author

@qnkov
Copy link

qnkov commented Jun 9, 2018

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.

@aliTalaea
Copy link

Hi Michelle, can you tell where to apply this code please?

@chellestein
Copy link
Author

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