Tag Info

New answers tagged

0

Try something like this : $value = get_field('field_name'); Try whole process based on this http://www.advancedcustomfields.com/resources/how-to/filter-posts-by-custom-fields/ $value = get_field('field_name', $category->cat_ID);


1

The issue is that there is no taxonomy meta data like there is for posts. ACF taxonomy data is stored serialized in the options table, so it can't be queried like post meta can. You have to load all terms and check the data associated to each one individually. Perhaps a better solution is to create Romance, Action, & Drama parent terms, and make your ...


0

The ACF Documentation recommends checking the values individually rather than simultaneously using an array. The following code is from the ACF Documentation for the Checkbox field type: http://www.advancedcustomfields.com/resources/field-types/checkbox/ /* * Query posts for a checkbox value. * This method uses the meta_query LIKE to match the string ...


0

If I am correct, you have a field that contain an array, to be clear, something that you can save using: add_post_meta( $postid, 'delivery_method', array('Online', 'Scheduled') ); Then you want to query posts where field 'delivery_method' = array( 'Online', 'Scheduled'). The problem is that a meta query like the yours: $meta_query = array( array( ...


1

Throwing the solution here for better reading. $field = get_field_object('field_name'); $value = get_field('field_name'); $label = $field['choices'][ $value ]; The value in $label will be the label related to the value set in $value.


0

I assume that the ACF you added to your post type "book" is a "Post Object" with the option "select multiple values" acitvated. So for each book you have, multiple stores can be linked to this one. Here is some code that could help you : <div class="bookdata"> <?php // Get the linked stores // if the ACF is a type "Post Object" and the ...


0

I discovered the problem by inspecting the actual SQL created by WP_Query. I realized that the generated SQL query has 2 INNER JOINs, one for the meta_key and another for the actual meta_query. Basically on one hand it is filtering those films that have a showings_%_start_datetime in the next seven days, and on the other hand (independently) it is ordering ...


0

You can capture the list in a variable, rather than echo it: $list = '<ul class="strong"> <li>' . get_field( 'highlights_list_item#1' ) . '</li> <li>' . get_field( 'highlights_list_item#2' ) . '</li> </ul>'; echo do_shortcode( '[one_half]' . $list . '[/one_half]' ); Note the use of get_field() ...


2

I managed to get this working using nothing but WordPress filters, thanks to @Milo's hint. Just note that these are pretty specific to my case but you shouldn't have a problem modifying them for your own use. I am using Advanced Custom Fields with a Date Picker field called date and Prev/Next links only point to events with date fields set to any day before ...


0

I was able to get this working by using the if statement at the top of the archive template instead of inside functions.php. This may not be as efficient as including it in a functions.php file (2 queries, possibly?) but at least it works for me now.


0

You can not specify which field, but you can use the filter *aioseop_description* to do whatever you want with the description before presenting. So technically, you can use your custom field as follows (untested) : add_filter('aioseop_description','my_custom_description'); global $post; function my_custom_description($text) { $mycustomseo = ...


0

This one did the trick! global $post; $taxes = array('ingredients','foodtype', 'eventtype'); $terms = get_the_terms($post->ID, $taxes); $products = array(); if( !empty($terms) ){ foreach($terms as $term) { if(get_field('relatedproducts', $term->taxonomy.'_'.$term->term_id )){ while( have_rows('relatedproducts', ...


2

the_field() is an ACF function and will echo content. It follows the WordPress (somewhat) pattern whereby functions with the_ at the front will echo content and functions beginning with get_ return content. Displays the value of the specified field. (this is the same as “echo get_field($field_name)”) ...



Top 50 recent answers are included