Support

Account

Forum Replies Created

  • Hey John, it’s everything in the if statement. However, the original field was named “banner”, I fix the “problem” by renaming the cloned group to something else and it solved the issue. It is still using “banner” somehow. Hope I am making sense!

  • Fait plaisir, bonne journée du Québec! 😛

    You can do a lot with JetEngine, so enjoy!

  • De rien! Yes that is the one, I think it is more complete for advanced tasks like these 🙂

  • Bon matin! Well I tried on my end and it’s working fine using JetEngine and their “Dynamic Field” widget (and call back). Using the “Heading” widget like you did there’s no option to output the term’s name, it only shows the ID 🙁

  • Salut! Can you share a screenshot of your PHP that outputs your field?

  • Finally solved, here’s the final code for anyone interested. Will sleep less dumb tonight! Thank you very much John!

    <?php 
    
    // args
    $args = array(
      'order'       => 'DESC',
      'orderby'     => 'date',
      'posts_per_page'	=> -1,
      'post_type'		=> 'post',
    );
    
    // query
    $posts_query = new WP_Query( $args );
    
    ?>
    <?php if( $posts_query->have_posts() ): ?>
      <?php while ( $posts_query->have_posts() ) : $posts_query->the_post(); ?>
      
      <div class="swiper-slide">
        <a href="<?php the_permalink(); ?>" class="c-card-article">
          <div class="c-card-article__img mb-15">
            <div class="c-card-article__overlay">
              <i class="icon-arrow-right"></i>
              <div><?php _e('Plus de détails', 'credo'); ?></div>
            </div>
    
            <?php $terms = wp_get_post_terms($post->ID, 'category');  foreach ($terms as $term) : $image = get_field('logo_image', $term); ?>
              <img src="<?php echo esc_url( $image['url'] ); ?>" class="c-card-article__cat" />
            <?php endforeach; ?>
        
            <?php the_post_thumbnail( 'large', array( 'class' => 'u-w-100' ) ); ?>
          </div>
          <p><?php the_title(); ?></p>
        </a>
      </div>		
    
      <?php endwhile; ?>
    <?php endif; ?>
    
    <?php wp_reset_postdata(); ?>
  • Hey John, thanks for you answer. I tried but it results in nothing. My posts are well associated with a category and those categories have a “logo_image” in place. I think i’m dumb AF or it’s just because i’m a frontend guy, can you help me out a little bit more? You’d be my xmas angel! <3

    <?php 
    
    $terms = wp_get_post_terms();
    
    // args
    $args = array(
      'order'       => 'DESC',
      'orderby'     => 'date',
      'posts_per_page'	=> -1,
      'post_type'		=> 'post',
    );
    
    // query
    $posts_query = new WP_Query( $args );
    
    ?>
    <?php if( $posts_query->have_posts() ): ?>
      <?php while ( $posts_query->have_posts() ) : $posts_query->the_post(); ?>
      
      <div class="swiper-slide">
        <a href="<?php the_permalink(); ?>" class="c-card-article">
          <div class="c-card-article__img mb-15">
            <div class="c-card-article__overlay">
              <i class="icon-arrow-right"></i>
              <div><?php _e('Plus de détails', 'credo'); ?></div>
            </div>
    
            <?php 
              foreach ($terms as $term) {
                $image = get_field('logo_image', $term);
              }									
            ?>
    
            <?php the_post_thumbnail( 'large', array( 'class' => 'u-w-100' ) ); ?>
          </div>
          <p><?php the_title(); ?></p>
        </a>
      </div>		
    
      <?php endwhile; ?>
    <?php endif; ?>
    
    <?php wp_reset_postdata(); ?>
  • Hey John, hopefully you can help me. I am working with ACF Theme Code Pro and the provided code I think works only on an archive page (?). I am just trying to output an image field put on my taxonomy in a WP_Query. Is the below code should be working considering that I need to replace “NULL” with something else? Thanks a lot!

    <?php 
    					
    // Acf Taxonomy Fields
    $taxonomy_prefix = 'category';
    $term_id = NULL;
    $term_id_prefixed = $taxonomy_prefix .'_'. $term_id;
    $image = get_field( 'logo_image', $term_id_prefixed );
    
    // args
    $args = array(
      'order'       => 'DESC',
      'orderby'     => 'date',
      'posts_per_page'	=> -1,
      'post_type'		=> 'post',
    );
    
    // query
    $posts_query = new WP_Query( $args );
    
    ?>
    <?php if( $posts_query->have_posts() ): ?>
      <?php while ( $posts_query->have_posts() ) : $posts_query->the_post(); ?>
      
      <div class="swiper-slide">
        <a href="<?php the_permalink(); ?>" class="c-card-article">
          <div class="c-card-article__img mb-15">
            <div class="c-card-article__overlay">
              <i class="icon-arrow-right"></i>
              <div><?php _e('Plus de détails', 'credo'); ?></div>
            </div>
    
            <?php if ( $image ) : ?>
              <img src="<?php echo esc_url( $image['url'] ); ?>" alt="<?php echo esc_attr( $image['alt'] ); ?>" class="c-card-article__cat">
            <?php endif; ?>
        
            <?php the_post_thumbnail( 'large', array( 'class' => 'u-w-100' ) ); ?>
          </div>
          <p><?php the_title(); ?></p>
        </a>
      </div>		
    
      <?php endwhile; ?>
    <?php endif; ?>
    
    <?php wp_reset_postdata(); ?>
  • Hey @nwde you are a life saver, it’s working!

    Thanks a lot!

  • I tried the exact above code (in and out a repeater) but it doesn’t seem to working anymore. Do you guys happen to know why?

  • Hey @nwde did you find the answer? I am looking for the exact same thing!

  • You’re a life saver, a small typo here: $has_fitlers

    Corrected it, thanks a lot man! 😀

  • Hello, I would need your help on something a bit similair. If “filters” is empty, hide <div class=”row spacer-bottom-sm”>, <div class=”col”> and <ul class=”list-labels d-none d-lg-flex”> — Is this possible?

    
    <!-- Filters -->
    <?php if( have_rows('portfolio') ): ?>
    <div class="row spacer-bottom-sm">
    	<div class="col">	
    		<ul class="list-labels d-none d-lg-flex">
    		<?php while( have_rows('portfolio') ): the_row(); ?>
    			<?php if( have_rows('filters') ): ?>
    				<li><button class="label active" data-filter="*">Tous</button></li>
    
    				<?php while( have_rows('filters') ): the_row(); 
    					$title = get_sub_field( 'title' );
    					$class = get_sub_field( 'class' );
    				?>
    
    				<li><button class="label" data-filter=".<?php echo $class; ?>"><?php echo $title; ?></button></li>
    
    				<?php endwhile; ?>
    			<?php endif; ?>
    		<?php endwhile; ?>
    		</ul> 
    	</div>
    </div>	
    <?php endif; ?>	
    
  • Hey @ardblok, thanks for that, however I am unable to strip the accents (French lang) off the field. It looks like this “marquage-int%c3%a9rieur” any ideas on how to clean this? 🙂

    Thanks!

  • Hi thanks for your answer, I don’t remember on which project I needed that in February but I’m pretty sure your solution will work for future projects.

    🙂

  • An idea came across my mind, since those fields are on the homepage (front page), I stored the front page ID in a variable like so:

    $homepage = get_option(‘page_on_front’);

    Everything works now! 😀

Viewing 16 posts - 1 through 16 (of 16 total)