How to automatically populate a checkboxes options

Home Forums Quform WordPress How to automatically populate a checkboxes options

This topic is: resolved
Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #4251
    casagentili
    Participant

    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

    #4279
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #4379
    casagentili
    Participant

    Hi 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
    Marco

    #4394
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #4402
    casagentili
    Participant

    Ally,

    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

    #4409
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #4410
    casagentili
    Participant

    wow! looks very triky,

    now I got it, and your code works perfectly

    many thanks
    Marco

    #5390
    Mindaugas
    Participant

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

    #5391
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #5396
    Mindaugas
    Participant

    Thank you.

    Can you please delete my previous post with portfolio template code?

    #5404
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #5538
    Brian
    Participant

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

    #5542
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #5551
    Brian
    Participant

    I 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

    #5554
    Brian
    Participant

    Please ignore that last post (you can remove it and this one)….thank you for your help….the above information works perfectly!

Viewing 15 posts - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy