Hi, John
It’ s a select field allowing multiple selections
Sorry, I try this, but still not work.
<?php
if ( is_singular( 'playlists' ) ):
$current_category = get_field( 'categorias', get_the_ID() );
if( have_posts() ): ?>
<ul>
<?php while ( have_posts() ) : the_post();
if (get_field('categorias') == $current_category): ?>
<li>
<a href="<?php the_permalink(); ?>">
<img src="<?php the_post_thumbnail('thumbnail'); ?>" />
</a>
</li>
<?php endif; ?>
<?php endwhile; ?>
</ul>
<?php endif; // have_post ?>
<?php endif; //is_singular ?>
Hi, Kaitlyn
thanks, but I’m not know what’s still wrong
<?php
if ( is_singular( 'playlists' ) ):
if( have_posts() ): ?>
<ul>
<?php while ( have_posts() ) : the_post();
$current_id = get_the_ID();
$currentCat = get_field('categorias', $current_id);
if (get_field('categorias') == $currentCat): ?>
<li>
<a href="<?php the_permalink(); ?>">
<img src="<?php the_post_thumbnail('thumbnail'); ?>" />
</a>
</li>
<?php endif; ?>
<?php endwhile; ?>
</ul>
<?php endif; // have_post ?>
<?php endif; //is_singular ?>
Thanks ! This is works:
<?php
$post_object = get_field('project_name');
if( $post_object ): ?>
<div>
<h4><?php echo get_the_title($post_object->ID); ?></h4>
<span>Post Object Custom Field: <?php the_field('project_description', $post_object->ID); ?></span>
</div>
<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
<?php endif; ?>
I think using post object would be better
Hi, John
It’s a a select field that I’ve added choices
But I do not know if this is the simplest way to do
Thanks John !
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.