Support Forum
I'm having the same issue this person did: https://support.metabox.io/topic/user-dashboard-displays-regular-posts/
I use the ProfileGrid plugin, where I've added the user dashboard shortcode to display a user's posts. It's only showing blog posts and not CPTs, when I need it to show CPTs.
Hello Tanja,
Please add the attribute post_type
to the frontend dashboard shortcode to show the CPT posts. For example:
[mb_frontend_dashboard edit_page="124" post_type="cpt-slug-here"]
Let me know how it goes.
Thank you. I'll give that a shot. What is this in reference to, though? edit_page="124" Not sure what I should replace that with.
One other question, what if I have multiple CPTs?
This is what I put in (I figured out the page ID for the page the shortcode is on).
[mb_frontend_dashboard edit_page="30855" object_type="directory"]
And I get an error that says "Model name is required"
<div class="rwmb-error">Model name is required</div>
Following up on this...
I also tried creating a test edit page with the user dashboard in Bricks, and it will show on the backend, but not the front. But if I try to add the regular shortcode on that same page: [mb_frontend_dashboard edit_page="124"], it says the content is empty. It is not.
Also, can you include multiple CPTs? It seems with the Bricks element you are limited to one.
Hello,
Sorry, the attribute for the post type should be post_type
[mb_frontend_dashboard edit_page="30855" post_type="directory" object_type="post"]
Following the documentation https://docs.metabox.io/extensions/mb-frontend-submission/#user-dashboard
Thank you Peter. That worked. Can I include two different CPTs, though? And also, can I cap it to show only X number of listings? I ask because I have a directory and under my own dashboard, there are 4000 listings and it's causing loading issues. Thank you!
Hi,
I'm still waiting to hear back on including multiple CPTs on the dashboard. I also was able to create some code to limit the amount of listings that load at once, but is there some way to create pagination??
I'm also getting confused by the edit post function. If I have a front end submission form that's different for each CPT, then I'd have two different edit pages? The documentation is really unclear and this is not intuitive.
Thanks.
Hello,
Can I include two different CPTs, though?
No, it shouldn't be. You should add one post type to a frontend form per page and have one dashboard/edit page per post type.
Thanks Peter---still waiting on answers for my other questions regarding A) adding pagination or B) limiting the number of posts that load on the dashboard. Thanks.
Hello,
There isn't an option to add the pagination to the dashboard. If you want to limit the number of posts on the dashboard, you can use the filter hook rwmb_frontend_dashboard_query_args
to modify the query argument posts_per_page
. For example:
add_filter( 'rwmb_frontend_dashboard_query_args', function( $args ) {
$args['posts_per_page'] = 15; // show 15 posts
return $args;
} );
Following the documentation https://docs.metabox.io/extensions/mb-frontend-submission/#dashboard
Am I missing something? I've added this to Scripts Organizer and it's still returning all posts:
<?php
add_filter( 'rwmb_frontend_dashboard_query_args', function( $args ) {
$args['posts_per_page'] = 30; // show 30 posts
return $args;
} );
?>