Support » Plugin: Ultimate Member - User Profile & Membership Plugin » Custom post type on user’s profile

  • nikolas27

    (@nikolas27)


    Hello, there is a “post” tab on user profiles which shows the posts of the particular user (please check the link above)

    Is it possible to show the custom post types on the user profiles too?
    Thanks a lot in advance

    https://ibb.co/vDvyr1y

    • This topic was modified 9 months ago by .
Viewing 7 replies - 1 through 7 (of 7 total)
  • nikolas27

    (@nikolas27)

    Thank you for your quick answer. Unfortunately the tutorial is not accurate. Probably because it is outdated. regards

    Thank you very much for your update, where should i put the code?

    Hi,

    I have exactly the same request. Unfortunately, I follow steps from the article but my posts.php file haven’t got any line mentioned from it. Here what I’ve got : https://image.noelshack.com/fichiers/2019/19/1/1557150305-codepostsphp.png

    Is it normal ?

    Thanks in advance,

    @dydybetty11 It seem as though you used code from the outdated section. You can undo this and use just the filter.

    
    function custom_um_profile_query_make_posts( $args = array() ) {
    
        // Change the post type to our liking.
    
        $args['post_type'] = 'page';
    
        return $args;
    
    }
    
    add_filter( 'um_profile_query_make_posts', 'custom_um_profile_query_make_posts', 12, 1 );
    

    @nikolas27 I will add an installable zip file but the best way to add the code is through a child-theme or a custom plugin.

    Thank you very much it works ! I have one further question. With this code, my post type was replaced. Is it possible to keep the defaut post type and add my custom post ?

    Thanks in advance,

    Hello, any updates with the installable zip? thanks

    @suiteplugins how if I have 2 custom post type

    e.g

    function custom_um_profile_query_make_posts( $args = array() ) {

    // Change the post type to our liking.

    $args[‘post_type’] = ‘my_cpt_one’;
    $args[‘post_type’] = ‘my_cpt_two’;

    return $args;

    }

    add_filter( ‘um_profile_query_make_posts’, ‘custom_um_profile_query_make_posts’, 12, 1 );

    I try use that code but not working if for 2 CPT

    thanks befor

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Custom post type on user’s profile’ is closed to new replies.