Forums

[Plugin: Custom Field Template]: Call multiple checkbox-items (2 posts)

  1. guzh
    Member
    Posted 2 months ago #

    Hi,
    I'm using the Custom Field Template-plugin. It's awesome, but I can't seem to figure out how to display more than one checkbox-item in my page-template.

    When I use the checkbox and I check f.ex two items the plugin adds two custom fields with the same name. and my php-code only call the lowest one. How do i call all values of custom fields with the same name?

    f.ex:

    [my_checkbox]
    label = What fruit?
    type = checkbox
    value = apple # orange # banana # grape

    If I choose "apple" and "orange" and I then call: get_post_meta($post->ID, 'my_checkbox', true)

    it only displays "apple". How do I display all, and how do I make it like a list?

    http://wordpress.org/extend/plugins/custom-field-template/

  2. Hiroaki Miyashita
    Member
    Posted 2 months ago #

    If you set false to the third argument, the function returns an array of the custom fields. Please look at the following link:

    http://codex.wordpress.org/Function_Reference/get_post_meta

Reply

You must log in to post.

About this Topic