PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Add Dropdown list post

  1. Good evening and congratulations for the great plugin!
    Let me explain my need: in a normal form, can I insert a drop down menu that contains the list of all articles written by the user logged in? If this is not possible, you can add the list of posts equal to that for the categories? Thank you very much, I look forward to your response!
    thanks.
    Andy.

    Posted 13 years ago on Sunday October 23, 2011 | Permalink
  2. Hello, I still have not found the solution, you can help me?
    regards
    Andy

    Posted 13 years ago on Monday October 24, 2011 | Permalink
  3. no one can help me please?
    Regards
    Andy

    Posted 13 years ago on Monday October 24, 2011 | Permalink
  4. Hi Andy. You caught us on the weekend and we're back online now.

    Sounds like you want to pre-populate a drop down list with all the posts written by the user. This might help:

    http://www.gravityhelp.com/forums/topic/pre-populate-dropdown-from-title-field-of-custom-post-type#post-19550

    There is some code posted by David Smith to retrieve posts to populate a drop down. You will use the same process, but your loop will limit the posts to those written by the logged in user.

    Posted 13 years ago on Monday October 24, 2011 | Permalink
  5. All you do is great! Thank you for having responded to me.
    I have a problem, I followed the post that I have mentioned but I can not change the funcion.php of my theme!
    When insert the code in the file, (this code http://pastie.org/1617402 ) the site returns me the blank page.
    I think it's due to poor implementation of the code (I'm sorry but I am a beginner) This is my code : http://pastie.org/2755267 Could you tell me where wrong? Thank you!
    regards

    Posted 13 years ago on Tuesday October 25, 2011 | Permalink
  6. Couple problems in that file. Please use this to replace that file completely.

    http://pastebin.com/PYKJG2yZ

    SAVE A BACKUP of your old file, just in case (the pastie.org will serve as a good backup.)

    One problem was a missing closing brace. Another problem which would have showed up later: you pasted the code from David Smith in twice, with the same function names. If you want to use the functions more than once, you will need to rename the function the second time you use it.

    Give this a shot: you should at least get rid of the white screen. Then we can work from there.

    Posted 13 years ago on Tuesday October 25, 2011 | Permalink
  7. Thanks for the support Chris! now no longer show the blank page but when I enter my ID on this line $ dropdown_field dropdown = myid; ($ dropdown_field = 8) The dropdown don't resituisce no results! : ( can not figure out where i wrong: (thanks again for your support
    Regards
    Andy

    Posted 13 years ago on Tuesday October 25, 2011 | Permalink
  8. Please post your functions.php again at pastebin.com or pastie.org and also post a link to your site with the form active so we can see what's going on.

    Posted 13 years ago on Wednesday October 26, 2011 | Permalink
  9. Hello Chris and thank you again for your support.
    Now I can not let you view the site because the customer has set his homepage Underconstruction: (
    This is my funcions.php http://pastebin.com/kyiZYWsZ
    What I do not understand in this portion of code is line 50 (in my code), I just enter the id field dropdown?
    Before asking the media again, I also tried the code in this post by Carl Hancock http://www.gravityhelp.com/forums/topic/automatically-populate-a-dropdown-with-post-titles # post-2646, and with this method i can see the first 5 post but does not filter by category: (uff! i admire your work and I hope to solve the problem! THANKS
    Regards
    Andy

    Posted 13 years ago on Wednesday October 26, 2011 | Permalink
  10. Reference: http://codex.wordpress.org/Template_Tags/get_posts

    It's returning 5 posts because that's the default for the WordPress function get_posts. To return all posts in the category, make line 62 in your paste look like this:

    [php]
    $posts = get_posts
    ("numberposts=-1&post_type=$post_type");

    Change the -1 there to a specific number to get that number of posts returned. If you want 10 posts, change -1 to 10. If you want 17, change the -1 to 17.

    On line 50, yes, you enter the field in your form you want to be populated with this function.

    On line 51, the name of your custom post type is typically lowercase. If you look in the wp_posts table, the column "post_type" would have the values you can use. Can you look there to be sure you have the capitalization and spelling exact?

    It's a complex customization, but once you have it done, it will be very nice. Keep at it.

    Posted 13 years ago on Thursday October 27, 2011 | Permalink