Support

Account

Home Forums Front-end Issues Display field on front end (without form)

Solving

Display field on front end (without form)

  • Hi there,

    Does anyone know if there’s an easy way to display a field on the front end without having it linked to edit an existing post, create a new post or outputting any other form elements (e.g. form tag, submit button)?

    Essentially I’d just like to output the HTML of a checkbox field to the front end.

    The reason I ask is I have a search function that allows users to filter posts based on an ACF checkbox field. I can do this easily by replicating the checkbox field options in HTML however I’d like the filter options to update when the ACF field is updated.

    I’ve taken a look at acf_form() but it looks like it’s geared towards editing/updating content – I just want to allow users to search/filter content by the same checkbox fields that are used to create the content.

    Would appreciated any thoughts,
    Cheers.

  • Hi @mingis

    maybe you can try something like this?

    acf_form(array(
        'post_id' => 'new_post',
        'form' => false,
    ));

    You can also use ‘fields’ option to choose which fields you want to show. This page should give you more idea about it: http://www.advancedcustomfields.com/resources/acf_form/.

    Hope this helps!

  • Maybe a search plugin will work like facetwp or Search & Filter

  • Hi @kolhoffmmm

    I’m not sure if those plugins will work or not. Could you please try it first? Another solution would be using get_field_object() to get the field details instead of the value and automatically create the HTML form using PHP.

    I hope this makes sense.

  • Hi James, sorry for the late response I’ve been overseas!

    get_field_object() is just the ticket!

    Thanks so much for the info.

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

The topic ‘Display field on front end (without form)’ is closed to new replies.