Up to 50 percent off

Multiple Custom Post Types in Dashboard

This topic contains 13 reply and 8 voices, and was last updated by Georgi 9 years, 9 months ago
Viewing 13 Posts - 1 through 13 (of 13 total)
Author Posts
April 17, 2013 at 8:39 pm 2390
Georgi 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
April 17, 2013 at 8:44 pm 2391
Tareq Hasan Tareq Hasan

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’ ),`.

April 18, 2013 at 1:22 pm 2460
noomia noomia

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 ?

April 18, 2013 at 2:38 pm 2468
Tareq Hasan Tareq Hasan

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.

April 18, 2013 at 7:36 pm 2484
hatchmedia hatchmedia

Hey Tareq!

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

Damien

April 29, 2013 at 9:33 am 2966
noomia noomia

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…?

April 29, 2013 at 9:37 am 2967
Tareq Hasan Tareq Hasan

[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]

April 29, 2013 at 9:46 am 2971
noomia noomia

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…

April 29, 2013 at 10:05 am 2974
Tareq Hasan Tareq Hasan

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.

June 12, 2013 at 3:27 pm 4835
sungkhum sungkhum

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

August 16, 2013 at 4:12 pm 7017
jman057 jman057

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

Cheers!

August 22, 2013 at 1:51 pm 7293
i_ayo i_ayo

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.

February 18, 2015 at 11:25 am 36953
Kate Kate

Thanks for this solution!

February 18, 2015 at 3:01 pm 36990
Georgi Georgi

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 13 Posts - 1 through 13 (of 13 total)