Tag Info

Hot answers tagged

2

I guess it should work the way it is described in your question of default code for Advance custom fields Also as custom field are part of post you can use $post->name of custom field also.


2

You need to use the has_sub_field() method inside an if() statement. I've only included the affected code below to highlight the specific changes required. if (has_sub_field('vimeo_id')): // Added if() // ... endif; You also need to a use the get_sub_field() function here as opposed to the has_sub_field() function: <iframe ...


1

All of these cost another DB Query (each!), and worse still since they are in a loop each one happens around 300 times. Don't panic! The posts from your query are stored in WordPress' object cache (which is simply memory, unless you have a custom cache system in place). All functions that operate on posts route through this cache, so in your case ...


1

Isn't that just the regular WP loop? Don't think this is related to ACF, since as you say this distance-thing isn't a custom field and ACF is made for working with those. Not sure how you build this without seeing more code. But couldn't you go something like $post->distance ?


1

If you'r using ACF plugin you should look the documentation first, here's relevant ACF saves taxonomies terms meta to options table, and they can be accesed using get_field( "{$field_key}", "{$term->taxonomy}_{$term->term_id}" ); So in you'r example it would be: $image = get_field( 'featured_image', 'product-category_' . ...


1

Your string example is wrong. You´re ending the echo statement right after opening the <div>. It should look like this: echo '<div class="quarter"><img src="' .$image[0]. '" alt="Logo"></div>';



Only top voted, non community-wiki answers of a minimum length are eligible