How can I output the custom fields wrapping with HTML

There are many things in your code, I don’t know why you implemented like that. In my view the corrected code should be: <?php if ( get_post_meta( $post->ID, ‘the_link’, true ) != ” ) : ?> <span class=”the_one field1″> <a href=”https://wordpress.stackexchange.com/questions/125102/<?php echo esc_attr(get_post_meta( $post->ID,”the_link’, true )); ?>”> <b data-icon=”info” class=”inner-content”><?php echo _e( ‘Content’, ‘theme-text-domain’ ); … Read more

Let Users Filter Posts by Custom Fields

Have you ever try to use ‘custom taxonomy’ to categorize the cars? I think taxonomy should be a more proper way to do this. You could register car brands like: // Register Custom Taxonomy function wpse_131586_custom_taxonomy() { $labels = array( ‘name’ => _x( ‘Brands’, ‘Taxonomy General Name’, ‘wpse’ ), ‘singular_name’ => _x( ‘Brand’, ‘Taxonomy Singular … Read more

Querying Advanced Custom Fields

Try using a meta_query in your $args. You are far more flexible this way. For the full reference of the possibilities check the Codex $args = array( ‘post_type’ => ‘Product’, ‘posts_per_page’ => -1, ‘orderby’ => ‘title’, ‘order’ => ‘ASC’, ‘meta_query’ => array( array( ‘key’ => ‘product_type’, ‘value’ => ‘Paper’, ‘compare’ => ‘=’, ) ) );

Sorting the portfolio by an ACF? [closed]

I just did someting like this with my portfolio. Here’s what I used to get mine working: $args = array( ‘post_type’ => ‘portfolio’, ‘posts_per_page’ => ‘-1’, ‘meta_key’ => ‘date_received’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘DESC’ ); remove_all_filters(‘posts_orderby’); $query = new WP_query($args); I have a CPT and using ACF datepicker called “date_received”. I had a lot … Read more

Limit search field to just search a custom post type with custom fields

post_title isn’t a valid argument to WP_Query. If you dump the SQL you will see that it is ignored: string(189) “SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_type=”investigator” AND (wp_posts.post_status=”publish”) ORDER BY wp_posts.post_title ASC LIMIT 0, 6″ You can use name (or pagename) instead, but you cannot push raw SQL through like that. It … Read more