How can I return the values of a custom field in the main query?

Question

The query below returns a collection of posts, pages and a custom post type called vehicles.

 if( $query->is_main_query() ) {
    $query->set( 'post_type', array( 'post', 'page', 'vehicles' ) );

with add_action( 'pre_get_posts', 'function_name' );

Is there a way I can I can return the values of a custom field similar to the content or excerpt of a post or page along with with ‘Read More` in an existing theme such as GeneratePress or Kadence?

I’m aware of get_field however I’m unsure if it can be used with a theme.

0
Motivated 2 weeks 2022-09-12T02:26:59-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse