Now
charecter field
not display how to fix it.
Thank you.
<?php if( have_rows('cast') ):
$tax = 'celebrity_cat';
$types = get_terms( array(
'order' => 'des',
)
);
foreach($types as $type) {
$term_link = get_term_link( $type );
$person_name = get_field('celebrity_name');
$image = get_field('celebrity_avatar', 'celebrity_cat_' . $type->term_id . '' );
$charecter = get_field('charecter');
if ( has_term( $type->term_id, 'celebrity_cat')) {
?>
<div class="slider">
<article id="post-<?php the_ID(); ?>" <?php post_class('content-item -card'); ?>>
<?php
echo '<div class="pic">';
echo '<a href="' . esc_url( $term_link ) . '">';
echo '<img width="350" height="184" src="' . $image['url'] . '" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" ';
echo '</a>';
echo '</div>';
echo '<div class="info">';
echo '<header class="entry-header">';
echo '<h3 class="entry-title">';
echo '<a href="' . esc_url( $term_link ) . '">';
echo '<span>'. $type->name . '</span>';
echo '</a>';
echo '</h3>';
?>
<?php echo $celebrity_name; ?>
<?php
echo '</header">';
echo '</div>';
//break;
?>
</article>
</div>
<?php } } ?>
<?php endif; ?>
Or how to showing only one more
i need one more somone can help me?
Thanks
this code is working.
Thanks.
<?php
$term = get_queried_object();
$website = get_field('website', $term);
?>
<?php if( $website ): ?>
<a target="_blank" href="<?php echo $website['url']; ?>"><span><i class="si-globe"></i></span></a>
<?php endif; ?>
The problem has been resolved.
<?php
if( have_rows('authors') ): while ( have_rows('authors') ) : the_row();
?>
<div class="entry-author ">
<?php $author_id = get_sub_field('user')['ID']; ?>
<div class="pic">
<a rel="author">
<img alt='' src='<?php echo get_field('image', 'user_' . $author_id )['url']; ?>'
class='avatar avatar-160 photo' height='160' width='160' />
</a>
</div>
<div class="info">
<h2 class="name"> <a href="<?php echo get_author_posts_url($author_id, $author_nicename) ?>"
rel="author"><?php echo get_sub_field('user')['display_name']; ?></a></h2>
<div class="desc"><?php echo get_field('role', 'user_' . $author_id); ?></div>
<div class="desc"><?php echo get_field('bio', 'user_' . $author_id); ?></div>
</div>
</div>
<?php endwhile; endif; ?>
<?php endif; ?>
anyone can help?
Mystery solved! But my biography It’s not showing yet. Can you recommend me?
I use this code Did not edit anything, because the field uses the same name.
<?php
$users = get_field("volunteers");
if( $users ): ?>
<ul class="volunteers-list">
<?php foreach( $users as $user ): ?>
<li>
<img src="<?php echo esc_attr( get_avatar($user->ID) ); ?>" alt="author-avatar" />
<a href="<?php echo esc_attr($user->user_url); ?>"><?php echo $user->display_name; ?></a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
Update now finally but i need show only primary someone can help?
<?php
$tax = 'company_categories';
$types = get_terms( $tax, $args = array(
'hide_empty' => false,
'post_type' => 'company',
'post_status' => 'publish',
'orderby' => 'name',
'order' => 'asc',
) );
foreach($types as $type) {
$term_link = get_term_link( $type );
$image = get_field('company_profile', 'company_categories_' . $type->term_id . '' );
if ( has_term( $type->term_id, 'company_categories') ) {
echo '<a href="' . esc_url( $term_link ) . '">';
echo "<img src='" . $image['url'] . "' width='150'> ";
//break;
//unset($term);
}
}
?>
Now Update my code is work but why this code show all i need display only primary just one categories.
<?php
$tax = 'company_categories';
$terms = get_terms( $tax, $args = array(
'hide_empty' => false, // do not hide empty terms
));
foreach( $terms as $term ) {
$term_link = get_term_link( $term );
$image = get_field('company_profile', 'company_categories_' . $term->term_id );
if( $term->count > 0 ) {
echo '<a href="' . esc_url( $term_link ) . '">';
echo "<img src='" . $image['url'] . "' height='130' width='150'> ";
echo $term->name .'</a>';
} elseif( $term->count !== 0 ) {
echo '' . $term->name .'';
}
}
?>
This code is work. But image show all i need a show only priamry and link to “company_categories” how to fix?
<?php
$terms = get_the_terms (
$post->ID, 'company_categories'
);
foreach($terms as $term) {?>
<?php
$image = get_field('company_profile', 'company_categories_' . $term->term_id);
if( !empty($image) ): ?>
<picture href="">
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" width="250" height="250" />
</picture>
<?php endif; ?>
<?php } ?>
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.