Problem:
The issue here is that the user wanted to set the parent post automatically when creating a chid post. Now the user will CREATE that parent post and when creating the child that parent should be set automatically.
Solution:
Add the following to your functions.php file
// Add Shortcode function user_post_id( $atts ) { // Attributes $atts = shortcode_atts( array( 'author_id' => '', 'cpt' => '', ), $atts ); $args = array( 'author' => $atts['author_id'], 'orderby' => 'post_date', 'order' => 'ASC', 'posts_per_page' => 1, 'post_type'=> $atts['cpt'] ); $post=get_posts($args); return $post[0]->ID; } add_shortcode( 'user_post_id', 'user_post_id' );
Then on your CRED form where it has the Parent Field on the edit form page add this as the value [user_post_id author_id="[wpv-current-user info='id']" cpt='post']
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Our next available supporter will start replying to tickets in about 0.46 hours from now. Thank you for your understanding.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
This topic contains 20 replies, has 2 voices.
Last updated by 6 years, 6 months ago.
Assisted by: Shane.