ACF won’t load from a custom JSON location
ACF won’t load from a custom JSON location
ACF won’t load from a custom JSON location
Performance optimization doesn’t really work in vaccum, it takes hands-on profiling an looking for actual bottle necks (which often turn out to be different from perceived ones). But it general there are several approaches to the need of lots of database data: Optimize fetching from database, for example by concatenating multiple requests into retrieving single … Read more
Use the get_the_terms function instead so you can build the list manually and access the term_id for each term. $terms = get_the_terms( $post->ID, ‘taxanomy-name’ ); echo ‘<ul>’; foreach( $terms as $term ): echo ‘<li>’; echo $term->name; the_field( ‘custom-field-name’, ‘taxanomy-name_’ . $term->term_id ); echo ‘</li>’; endforeach; echo ‘</ul>’;
You can use the “get_sub_field” to test for the subfields. If nothing is returned and they are empty, it won’t show the content associated with the if statement. <?php if ( get_field(‘ingredients-list’) ) { echo ‘<ul class=”ingredientsList”>’; while ( has_sub_field(‘ingredients-list’) ) { echo ‘<li class=”ingredient” itemprop=”ingredients”>’; echo ‘<label for=””>’ . get_sub_field(‘quantity’) . ‘ ‘; if … Read more
This function will clear WP Super Cache upon saving of ACF Options page. Enjoy! <?php /* Additional Function to prune the Cache if $post_id is ‘0’ or ‘options’ */ function f711_clear_custom_cache($post_id) { // just execute if the $post_id has either of these Values. Skip on Autosave if ( ( $post_id == 0 || $post_id == … Read more
Finaly, I make this working. I put this in my template: <?php $contacts = get_field(‘list_supplier’); ?> <?php if( $contacts ): ?> <?php foreach( $contacts as $contact ): ?> <a href=”https://wordpress.stackexchange.com/questions/118817/<?php echo get_permalink( $contact->ID ); ?>” target=”blank”><?php echo get_the_title( $contact->ID ); ?></a> <?php endforeach; ?> <?php endif; ?> And here is the filter I am using … Read more
First, keep in mind that pre_get_posts is a hook that is run on every single query that WP runs, so be very, very careful when utilizing it. That said, it is absolutely the best tool for what you want to do, and certainly better than writing a separate custom query in the page template. I’ve … Read more
I wasn’t adding the ID into the new array. if ( get_post_type( $post_id ) == ‘equipment’ ) { $my_post = array(); $my_post[‘ID’] = $post_id; $my_post[‘post_title’] = get_field( ‘name’, $post_id ); wp_update_post( $my_post ); }
I have to do similar things all the time. You are already using ACF, which is what I use, actually I use ACF5 Pro version now, but the same thing can be achieved using ACF4 and the Options Page add on. What I do is create an options page for each post type and set … Read more
I am doing the same thing at the moment and I just use the standard WP login/register systems/pages. You can use wp_signon() to do logon. Then on a standard page, you can create a custom template and use this for retrieving their info: wp_get_current_user() You will also need to get the customer user meta information … Read more