In a previous tutorial;  How to customize Ultimate Member templates, one learnt how to override UM templates. If you have not read it, it is a good idea to take a look before proceeding.

Step 1: Copy file to theme

For this tutorial, we are going to customize the posts.php file. Let’s setup our overriding folders and file. Inside of your theme create the following folders ultimate-member -> templates -> profile

Copy the file yourtheme-> ultimate-member -> templates -> profile -> posts.php to the previous created folder.

Step 2: Edit the file

Use the following code if you are using Ultimate Member 2.0+

Open the posts.php file using an IDE of notepad. Locate the line that has following

<?php $query_posts = UM()->query()->make('post_type=post&posts_per_page=10&offset=0&author=' . um_user('ID') ); ?>

After post_type=, change the word post to the post type that you would like for example um_story

<?php $query_posts = UM()->query()->make('post_type=um_story&posts_per_page=10&offset=0&author=' . um_user('ID') ); ?>

Next, let’s change the post type for the load more area. Find the line of the code that has the following

 <a href="#" class="um-ajax-paginate um-button" data-hook="um_load_posts" data-args="post,10,10,<?php echo um_user('ID'); ?>"><?php _e('load more posts','ultimatemember'); ?></a>

Where it says post,10,10 change post to the post type that you would like for example um_story,10,10

 <a href="#" class="um-ajax-paginate um-button" data-hook="um_load_posts" data-args="um_story,10,10,<?php echo um_user('ID'); ?>"><?php _e('load more posts','ultimatemember'); ?></a>

Save the file and there you have it. If you have followed the steps as mentioned here, you should now have a list of another post type.

Prior to Ultimate Member 2.0

Open the posts.php file using an IDE of notepad. Locate the line that has following

<?php $query_posts = $ultimatemember->query->make('post_type=post&posts_per_page=10&offset=0&author=' . um_user('ID') ); ?>

After post_type=, change the word post to the post type that you would like for example um_story

<?php $query_posts = $ultimatemember->query->make('post_type=um_story&posts_per_page=10&offset=0&author=' . um_user('ID') ); ?>

Next, let’s change the post type for the load more area. Find the line of the code that has the following

 <a href="#" class="um-ajax-paginate um-button" data-hook="um_load_posts" data-args="post,10,10,<?php echo um_user('ID'); ?>"><?php _e('load more posts','ultimatemember'); ?></a>

Where it says post,10,10 change post to the post type that you would like for example um_story,10,10

 <a href="#" class="um-ajax-paginate um-button" data-hook="um_load_posts" data-args="um_story,10,10,<?php echo um_user('ID'); ?>"><?php _e('load more posts','ultimatemember'); ?></a>

Save the file and there you have it. If you have followed the steps as mentioned here, you should now have a list of another post type.

We use this feature in our plugin Stories for Ultimate Member.

Happy Coding!

Featured Downloads

Buy Now

Buy Now

Buy Now