WordPress.org

Ready to get started?Download WordPress

Forums

Just Custom Fields
[resolved] How to display values of fieldsgroup? (4 posts)

  1. thatwastaxing
    Member
    Posted 2 years ago #

    Thanks for the plugin!

    How do I display the value of a fieldsgroup?

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

  2. Alexander Prokopenko
    Member
    Plugin Author

    Posted 2 years ago #

    All values are saved as usual post meta data. So you can get them with function
    $fields = get_post_meta($post->ID, 'my_field_group', true);
    where 'my_field_group' - is slug name of your fieldsgroup field.

    $fields variable will have an multiple Array inside, which should be similar to this:

    array(
       [(int)row_number] => array(
              [field1] => value1
              [field2] => value2
          )
    )

    Hope this helps. You can also read more info on our official plugin page:

    http://justcoded.com/just-labs/just-custom-fields-for-wordpress-plugin

  3. c_vallejos
    Member
    Posted 2 years ago #

    I have configured the following code!
    checkbox options
    negro|id1
    amarillo|id2
    verde|id3
    rojo|id4
    azul|id5
    morado|id6

    *****************************
    'PHP'

    '<div id="servicios">'
    '<ul class="fullservicio">'
    '<?php $servicios = get_post_meta($post->ID, 'servicios', true); ?>'
    '<?php foreach($servicios as $valor) { echo '<li id="'.$valor.'" alt="'.$.'">'; } ?>'
    ''
    '</div>'

    ****************************
    'view html'

    '<div id="servicios">'
    '<ul class="fullservicio">'
    '<li id="id1" alt="">'
    '<li id="id3" alt="">'
    '<li id="id5" alt="">'
    '<li id="id6" alt="">'
    ''
    '</div>'

    ***************************
    selected.. id1, id3, id5, id6
    WANT TO KNOW HOW TO SHOW THE NAMES ID1, ID3, ID5, ID6
    to show in ALT

    '<li id="id1" alt="NEGRO">'
    '<li id="id3" alt="VERDE">'
    '<li id="id5" alt="AZUL">'
    '<li id="id6" alt="MORADO">'

    THANKS ....

  4. Alexander Prokopenko
    Member
    Plugin Author

    Posted 2 years ago #

    Okay i've checked the code of my plugin and find the way you can do this:
    (but you need version 1.3 to do this)

    1) Inspect you element on Post Form (in this case "checkbox").
    find "name" attribute. It looks like "field-checkbox[12][val][]"
    you need the part in bold. from this you get that field ID is "checkbox-12".

    2) Use this code in your template:

    jcf_set_post_type('page'); // insert here post type you're using
    $field = jcf_field_settings_get('checkbox-12'); // insert ID here
    $field_settings = jcf_parse_field_settings($field['settings']);

    $field_settings will contain what you need.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic