ACF Relationship Field Search Filtering [closed]

First, read this post to understand my answer Search that will look in custom field, post title and post content You may want to use the acf/fields/relationship/query/ however, when adding the args: $args[‘meta_query’] = array(array( ‘key’ => ‘your_meta’, ‘value’ => $args[‘s’], ‘compare’ => ‘LIKE’, )); you will find that using that query, WordPress will search … Read more

ACF: get_field() returning false [closed]

You need to pass in the ID of the post you’re trying to get the field from: Eg get_field(‘display_featured_image’, $post_id). In a loop you could do get_field(‘display_featured_image’, get_the_id()); ACF Stores field data in wp’s meta_fields, so you could even use WP’s built in meta handler to pull the data yourself Eg: get_post_meta( $post_id, ‘acf_field_name’, true); … Read more

Using OR conditions in meta_query for query_posts argument

Use ‘relation’ => ‘OR’ as in the Codex example below: $args = array( ‘post_type’ => ‘product’, ‘meta_query’ => array( ‘relation’ => ‘OR’, /* <– here */ array( ‘key’ => ‘color’, ‘value’ => ‘blue’, ‘compare’ => ‘NOT LIKE’ ), array( ‘key’ => ‘price’, ‘value’ => array( 20, 100 ), ‘type’ => ‘numeric’, ‘compare’ => ‘BETWEEN’ ) … Read more

functions.php inject inline css

The easiest way I’ve seen is to echo it where you need it: function inline_css() { echo “<style>html{background-color:#001337}</style>”; } add_action( ‘wp_head’, ‘inline_css’, 0 ); Since 2019 you can also add styles inline inside the body, shown here without using echo: function example_body_open () { ?> <style> html { background-color: #B4D455; } </style> <?php } add_action( … Read more

Advanced Custom Fields select field : How to echo the label, not the value? [closed]

The get_field_object() function requires the field KEY not the field NAME. See docs: http://www.advancedcustomfields.com/resources/functions/get_field_object/ So it should looks something like this… $field = get_field_object(‘field_53d27f5599979’); $value = get_field(‘field_myfield’); $label = $field[‘choices’][ $value ]; You can find the field key by clicking on “Screen Options” > “Show Field Key” and it should appear next to the field … Read more

Advanced Custom Fields and Yoast SEO keyword analysis [closed]

Looking at the filter: $post_content = apply_filters( ‘wpseo_pre_analysis_post_content’, $post->post_content, $post ); it would be a matter of adding your fields content to string being analyzed. You have to do the get_field() part right, this is untested: add_filter( ‘wpseo_pre_analysis_post_content’, ‘filter_yoasts_wpse_119879’, 10, 2 ); function filter_yoasts_wpse_119879( $content, $post ) { $fields = get_field( ‘name’, $post->ID ); return … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)