Jay
Admite hilos creados en los últimos 30 días: 0
Debates favoritos del foro
Status | Debate | Supporter | Voces | Mensajes | Caducidad |
---|---|---|---|---|---|
I want to only display the parent items of the current user in a select box
Iniciado por: pascalS
en: Toolset Professional Support
Problem: Solution: 2. In the Parent Selector Code of that form you should use only default available arguments, as this: <div class="cred-group cred-group-parents"> <div class="cred-field cred-field-_wpcf_belongs_page_id">//change "page" to your parent post slug <label class="cred-label"> Choose Parent </label> <input type="hidden" id="parents_id" value="[get-parents]" /> This is only for test display: [get-parents] [cred_field field='_wpcf_belongs_page_id' value='']//change "page" to your Parent Post Slug </div> </div> 3. In the JS: jQuery('document').ready(function(){ var post_parents = jQuery('#parents_id').val(); var arr = post_parents.split(','); jQuery("[name=_wpcf_belongs_page_id] > option").each(function() { //change "page" to your parent post slug var option_val = jQuery(this).val(); if( jQuery.inArray(option_val, arr) == -1 && option_val != -1 ){ jQuery(this).remove(); } }); }); 4. In functions.php: function get_parents($atts) { global $current_user; get_currentuserinfo(); $author_query = array('post_type' => 'page', 'posts_per_page' => '-1','author' => $current_user->ID,); $author_posts = new WP_Query($author_query); $parent_ids = ""; while($author_posts->have_posts()) : $author_posts->the_post(); $parent_ids .= get_the_ID() .","; endwhile; return $parent_ids; } add_shortcode('get-parents', 'get_parents'); 5. in Views > Compatibility > 3rd party ShortCodes register: get-parents 6. If you insert the CRED Form in a Post, it correctly displays only parent Posts of current author/user. |
3 | 12 | hace 8 años, 4 meses | ||
Update on support of REST API?
Iniciado por: chrisH-10 en: Toolset Professional Support |
6 | 12 | hace 8 años, 5 meses | ||
Best practices/approach: Using posts for 'people' where users feild won't do.
Iniciado por: frankW-2 en: Toolset Professional Support |
2 | 3 | hace 8 años, 5 meses | ||
Help figuring out how to approach this
Iniciado por: tomA-2 en: Toolset Professional Support |
2 | 10 | hace 8 años, 9 meses | ||
A employee (user) dashboard – Relationship between users & CPTs / custom fields
Iniciado por: diegoF en: Toolset Professional Support |
2 | 10 | hace 8 años, 10 meses |