Forked from ultimatemember/gist:643cd90967e5e415378d
Created
February 10, 2019 20:07
-
-
Save 1gelone/09b028e17114dd3439fe130d81805b54 to your computer and use it in GitHub Desktop.
Custom profile tab example: showing user pages
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
| /* add a custom tab to show user pages */ | |
| add_filter('um_profile_tabs', 'pages_tab', 1000 ); | |
| function pages_tab( $tabs ) { | |
| $tabs['pages'] = array( | |
| 'name' => 'Pages', | |
| 'icon' => 'um-faicon-pencil', | |
| '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; | |
| $loop = $ultimatemember->query->make('post_type=page&posts_per_page=10&offset=0&author=' . um_profile_id() ); | |
| while ($loop->have_posts()) { $loop->the_post(); $post_id = get_the_ID(); | |
| ?> | |
| <div class="um-item"> | |
| <div class="um-item-link"><i class="um-icon-ios-paper"></i><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div> | |
| </div> | |
| <?php | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment