Home › Forums › Quform WordPress › How to automatically populate a checkboxes options
- This topic has 16 replies, 5 voices, and was last updated 8 years, 8 months ago by Ally.
- AuthorPosts
- May 3, 2013 at 10:38 am #4251casagentiliParticipant
Hi there,
I’m wondering if possible to populate checkboxes option list, automatically, e.g. list should contain all “post titles” for posts with a specified Category.
This means as soon as a new post is published with selected Category, the checkbox option list should contain a new item, the new post title
thanks
May 6, 2013 at 8:48 am #4279AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
May 10, 2013 at 3:28 pm #4379casagentiliParticipantHi Ally,
thansk for your script, it works well for me as well, axcept the following
1) when the post category is changed after the post is published there is no offect onto the checkboxes list (e.g.
– the post is linked to the category and published => post title is showed up in the form checkbox list (correct)
– within the the same post, the catergory is unchecked => the post title is still showed up in the checkboxlist (wrong)2) The checkbox list shows up max 3 post titles (I tried to add more posts but the oldest one is always removed from the list)
thanks
MarcoMay 12, 2013 at 10:37 am #4394AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
May 12, 2013 at 11:49 am #4402casagentiliParticipantAlly,
1) I refrasched the page by ctr F5; the list is still limited to 3 items.
2) I changed the line according to your new version; the checkbox now contains all the posts (not only the ones realated to selected category)
Also, I don’t have a category ID (i.e a nuber like the 9 you mention in your code); I may identify categories slugs, so my code is:
$query = new WP_Query(array(‘cat’ => lista-dei-desideri, ‘posts_per_page’ => -1));
where lista-dei-desideri is the category slug, I also tried to put the slug in single quote ‘ ‘ and double quote ” “, still didn’t worked
is there something wrong in what I did ?
Marco
May 13, 2013 at 8:52 am #4409AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
May 13, 2013 at 9:05 am #4410casagentiliParticipantwow! looks very triky,
now I got it, and your code works perfectly
many thanks
MarcoJuly 21, 2013 at 5:48 pm #5390MindaugasParticipantPerfect solution! But is there way to use this code for different taxonomy? In my theme I use portfolio posts with taxonomy “skills”. Here is example of portolio page template:
*SNIP*
Can be anyting done, that this solution would work with my portfolio posts?
July 22, 2013 at 9:41 am #5391AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
July 23, 2013 at 8:34 am #5396MindaugasParticipantThank you.
Can you please delete my previous post with portfolio template code?
July 23, 2013 at 6:09 pm #5404AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
July 31, 2013 at 3:57 am #5538BrianParticipantIs it possible to use this code to automatically populate a dropdown menu with all of the posts titles within a certain category as you did above for the checkboxes?
July 31, 2013 at 7:48 am #5542AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
July 31, 2013 at 6:22 pm #5551BrianParticipantI have added the code above to the functions.php, and updated all numbers/form values/and names as requested in the advice you gave.
Is there anything that I have to do when creating the form itself? Anything special to check or write?
Also are there any variables I should change since this is a scroll down menu rather than a checkbox?
Thank you
Brian
July 31, 2013 at 9:25 pm #5554BrianParticipantPlease ignore that last post (you can remove it and this one)….thank you for your help….the above information works perfectly!
- AuthorPosts
- You must be logged in to reply to this topic.