How to show amount of post in a taxonomy with advanced custom fields?

You can use this code for getting number of posts in a taxonomy: $args = array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘tax_query’ => array( array( ‘taxonomy’ => ‘your-taxonomy-name’, ‘field’ => ‘slug’, ‘terms’ => ‘some-slug’, ) ) ); $query = new WP_Query( $args ); echo $query->post_count;

How do I use “while” and “end while” inside of the echo do_shortcode with ACF Repeater?

You need to generate the shortcode within the loop, and then execute it afterwards: if ( have_rows( ‘homepage_slider’ ) ) { $shortcode=”[ux_slider timer=”4500″ arrows=”true” bullets=”true” auto_slide=”true” nav_color=”light”]”; while ( have_rows(‘homepage_slider’) ) { the_row(); $shortcode .= ‘[ux_banner bg=” ‘ . get_sub_field( ‘slider_image’ ) . ‘ ” height=”600px” text_color=”light” text_align=”center” text_pos=”center” text_width=”70%” parallax_text=”0″ parallax=”3″ effect=”sparkle”] <h1>’ . … Read more

display Flexible Fields from options

According to ACF Docs on Get values from an options page. You should use ‘option’ not ‘options’ as the second parameter to the have_rows() function. <?php if( have_rows(‘repeater’, ‘option’) ): ?> <ul> <?php while( have_rows(‘repeater’, ‘option’) ): the_row(); ?> <li><?php the_sub_field(‘title’); ?></li> <?php endwhile; ?> </ul> <?php endif; ?>

Advanced Custom Fields Show After Password [closed]

Reading the docs (never used flexible fields, only repeater fields, but look the same): <?php // check if the flexible content field has rows of data if( have_rows(‘flexible_content_field_name’) ): // loop through the rows of data while ( have_rows(‘flexible_content_field_name’) ) : the_row(); if( get_row_layout() == ‘paragraph’ ): the_sub_field(‘text’); elseif( get_row_layout() == ‘download’ ): $file = … Read more

ACF iterating past the while-loop, defining a max number to loop

If I compare the counter to five instead of the input (****), then it evaluates perfectly. Thanks to Milo for the help. <?php if( have_rows(‘program_skills’) ) : while( have_rows(‘program_skills’) ) : the_row(); ?> <div class=”skills-wrapper”> <div class=”col-xs-6″> <p><?php the_sub_field(‘heading’); ?></p> </div> <div class=”col-xs-6″> <div class=”skills-graph”> <ul> ****<?php for($i=1; $i<=5; $i+=1) if( $i <= get_sub_field(‘rating’) ) … Read more