Srcset incorrect with Owl Carousel and ACF?
Srcset incorrect with Owl Carousel and ACF?
Srcset incorrect with Owl Carousel and ACF?
You shouldn’t be using a custom query for a post type archive page. Pagination being difficult is one of the reasons. If you want to change your post type archive to sort by a custom field, hook into pre_get_posts to modify the main query: function wpse_282839_post_type_order( $query ) { if ( ! is_admin() && $query->is_post_type_archive( … Read more
PHP for loop not working as intended
Here you were trying to use echo as a method of DateTime object. $month = $date->echo date_i18n(‘F’); It should be: $month = date_i18n(‘F’, strtotime( $acf_date ) ); Where $acf_date is the time string not the DateTime object.
Use an image’s url as argument in update_field function
Allowing slash in slug/permalinks
Linking posts together with Advanced Custom Fields “both ways”
You’re mixing curly brackets and another syntax. This should help: <?php if(get_field(‘hero_video’, ‘option’) ) { $headervideo = get_field( ‘hero_video’, ‘option’ ); echo ‘<div class=”headervideo”>’ . $headervideo . ‘</div>’; } elseif ( get_field( ‘hero_upload’, ‘options’ ) ) { $headerupload = get_field( ‘hero_upload’, ‘option’ ); echo ‘<div class=”hero-video” data-vide-bg=”mp4: ‘ . $headerupload . ‘” data-vide-options=”loop: true, muted: … Read more
I’m not fun of helper functions so I would write it like this: $args=array( ‘post_type’ => ‘post’, ‘posts_per_page’ => ’20’, ‘post_status’ => ‘publish’, ‘order’=>’DESC’, ‘orderby’=>’ID’, ); $query = new WP_Query( $args ); if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); $current_id = $post->ID; echo the_field(‘field1’, $current_id); } wp_reset_postdata(); } else { // … Read more
I believe you need to use get_sub_field() for the repeater field (designer_achievements) and get_field() for its parent. Please take a look at the ACF documentation for the Repeater field’s subfield. You will also need to use a have_rows() loop, as noted in the documentation. if( have_rows(‘parent_field’) ): while( have_rows(‘parent_field’) ) : the_row(); $value = get_sub_field(‘sub_field’); … Read more