Support

Account

Home Forums Front-end Issues Returning the Name or Label of a Field in Search Results.

Unread

Returning the Name or Label of a Field in Search Results.

  • I am trying to figure out how to modify Search Results so it will also output the ACF Name or Label attached to the content. I have a number of fields attached to that custom post type, and I need to output the name of which ACf field the search term was found in.

    I used the code at http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_join to return the post that has the ACF field, but I need to output the actual field name or label in the search results.

    For example, I have a search term of “Frustration”. “Frustration” is located in an ACF Wysiwyg field attached to a post. The post has a number of other WYSIWYG fields as well. I am trying to figure out how to output just the name of the field that “Frustration” is found in when I output the loop.
    The end result would be something like


    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    ">
    <?php the_title(); ?><?php THE LABEL OR NAME OF THE FIELD IT'S LOCATED IN ?>

    <?php endwhile; endif ?>

    How can I find that?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.