Home Forums Plugin Support WP User Frontend Pro Multiple Custom Post Types in Dashboard

This topic is: resolved

This topic contains 13 replies, has 8 voices, and was last updated by  Georgi 4 years, 1 month ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #2390

    hatchmedia
    Participant
    Post count: 116

    Hi guys,

    I was hoping to find a solution to this.  I have multiple Custom Post Types, 4 to be exact.  When a user uploads a post, they can send it to any of the four custom post types.

    The Dashboard currently only shows 1 custom post type because I have [wpuf_dashboard post_type=”dogs”] added as the code.

    Is there a way to include all four custom post types into the dashboard so that the user can see all their posts, no matter which custom post type it shows from?

    Cheers

    Damien

    #2391

    Tareq Hasan
    Keymaster
    Post count: 2831

    You've to edit the `/class/frontend-dashboard.php` for this. See line 66: `'post_type' => $post_type,`. Change this to: `'post_type' => array( ‘dogs', ‘cats', ‘other_post_types' ),`.

    #2460

    noomia
    Participant
    Post count: 115

    If we do that and have to update the plugin after, we will loose the changes, right ? Could you make this possible through the admin ?

    #2468

    Tareq Hasan
    Keymaster
    Post count: 2831

    Right now, there is no other option rather than editing the plugin. Yes, you will loose the changes. Adding a filter is required to dashboard query I think.

    #2484

    hatchmedia
    Participant
    Post count: 116

    Hey Tareq!

    Thats seems to have worked for me perfectly, thanks very much for that again!

    Damien

    #2966

    noomia
    Participant
    Post count: 115

    Hi Tareq !

    Now that you have add the query filter, how can we choose the custom posts type ? I don't understand how to use your filter update…?

    #2967

    Tareq Hasan
    Keymaster
    Post count: 2831

    [php]
    function wpufe_dashboard_post_type( $args ) {
    $args[‘post_type'] = array( ‘post', ‘compnay', ‘etc…' );

    return $args;
    }

    add_filter( ‘wpuf_dashboard_query', ‘wpufe_dashboard_post_type' );
    [/php]

    #2971

    noomia
    Participant
    Post count: 115

    In my case, I also have to check the value of a custom field before display the posts. This value will be passed in the url. How would you do this ? And this is only for one dashboard. I have an other dashboard page which will “just” displays the normal posts, without custom query filters…

    #2974

    Tareq Hasan
    Keymaster
    Post count: 2831

    I can't say about your first question. But about the second one, you can pass different shortcodes for dashboard [wpuf_dashboard post_type="someting_random"] and then check the post type in $args and apply the filter.

    #4835

    sungkhum
    Participant
    Post count: 4

    I also needed multiple post types so thanks for the code!

    #7017

    jman057
    Participant
    Post count: 16

    Thanks for the function Tareq, was an easy solution for me too. Helped me to display multiple custom post types in the dashboard.

    Cheers!

    #7293

    i_ayo
    Participant
    Post count: 8

    Hi, i created a custom post type to be viewed in the dashboard, however the page where im meant to edit the post i.e where the shortcode [wpuf_edit] was put gives the message:

    “I don't know how to edit this post, I don't have the form ID”.

    Checked the FAQ and looked at the meta box “WPUF Form” but didnt see any form to select.

    Please how can i sort this out.

    #36953

    Kate
    Member
    Post count: 9

    Thanks for this solution!

    #36990

    Georgi
    Member
    Post count: 15

    Hmm, I am actually having quite the opposite problem. I haven’t edited the code, but my dashboard shows all custom post types, regardless of the post_type argument i specify in the shortcake when calling the dashboard. The problem is that I have two post types (garage and market) and would like to be able to have two separate pages listing the users’ posts for the garage and market. I did this by having two dashboard pages each specifying which custom post type to display. I don’t know what changed by now my dashboard is displaying all custom post types, no mather which argument is set.

    Can someone help me fix this? Thank you in advance! 🙂

Viewing 14 posts - 1 through 14 (of 14 total)

The topic ‘Multiple Custom Post Types in Dashboard’ is closed to new replies.