Viewing 1 replies (of 1 total)
  • Plugin Author Dani Llewellyn

    (@diddledani)

    Hi,

    You can use the content of the fields when displaying the items, but only the title is considered when sorting the items into alphabetical order. You cannot currently use the values in a/some field(s) as the items in an A-Z listing. Only Posts and Terms are currently supported.

    You can, however, use the filter a_z_listing_pre_index_item_title to change what the plugin sees as the title of a post based on the custom fields present:

    add_filter( 'a_z_listing_pre_index_item_title', 'override_a_z_titles', 10, 3 );
    function override_a_z_titles( $title, $item, $type ) {
        if ( $type !== 'posts' ) {
            return $title;
        }
        $new_title = get_field( 'field_name', $item->ID, false );
        return $new_title;
    }

    Ref for get_field: https://www.advancedcustomfields.com/resources/get_field/

Viewing 1 replies (of 1 total)

The topic ‘how search in custom fields’ is closed to new replies.