WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Custom Fields
Dynamic checkbox (1 post)

  1. mathew70
    Member
    Posted 1 year ago #

    I need to insert in a custom post a checkbox field. This checkbox must show a list of title of another custom post so I cannot insert the values in the "Choices" filed, I need a function to compile it dynamically.
    I've partially solved the problem with "Export Field Groups to PHP". In the function.php I have a query that compile an array with the title of the custom post I need, the in the array() of the checbox I put a list of variable:

    array (
          'label' => 'Name of Field',
          ...
          'choices' =>
          array (
            $value[0],
    	$value[1],
            ...
            $value[10],
          ),
          ...
        ),

    But the number of the values[] in the arry() are fixed, so if you insert a new post in the custom post this is not show in the checkbox.

    Any idea?
    Many thanks!
    Mathew

    http://wordpress.org/extend/plugins/advanced-custom-fields/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic