I would like to create a page that displays 3 ACF Values in an alphabetized list. I have a custom post type ="product" and would like to display the following twi fields (Both are ACF text fields) 1. vendor_or_brand_name and 2. product_url
I can output all post titles from the product post type like this:
function output_product_list() {
global $wpdb;
$custom_post_type = 'product';
$results = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_title FROM {$wpdb->posts} WHERE post_type = %s and post_status = 'publish'", $custom_post_type ), ARRAY_A );
if ( ! $results )
return;
$output = '<ul id="products">';
foreach( $results as $index => $post ) {
$output .= '<li id="' . $post['ID'] . '">' . $post['post_title'] . '</li>';
}
$output .= '</ul>'; // end of select element
return $output;
}
But when I try and modify 'post_title' to either of the ACF field values I get no output. Please advise.