Home Forums General Issues Shortcode for Title


Shortcode for Title

  • Hi there,

    is there a shortcode to call the title of a field?
    Even better would be a shortcode to call both, the titles AND values of a field group, is this possible?

    Another question, is it possible to add a class to each fields title? I want to display for example:

    – marker icon for the field location
    – bed icon for the field bedrooms

    so the class could just be the same as the title of the field and I add CSS classes.

    Thanks in advance and a merry Christmas to all of you 🙂

  • Hi @fireleaf

    Apologies for the delay.

    You can create a custom shortcode to do this and get the values using the get_field_object() function.

    Here is an example of how to achieve this:

    $field_name = "text_field";
    $field = get_field_object($field_name);
    echo $field['label'] . ': ' . $field['value'];

    Regarding the other question, please check out the wrapper attributes under the field edit screen.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Shortcode for Title’ is closed to new replies.