最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

advanced custom fields - Trying to add ACF to authors meta and adding a class at the same time

programmeradmin1浏览0评论

I am trying to add a an acf field called "name" while also adding a css-class to it

the_field('name')

to this code

if ($go_magazine_options['post_meta_author'] === 'enable' && in_the_loop()) {    
    echo '<span class="client">' . get_the_field('name') .
   '<span class="entry-meta-author author vcard"><i class="fa fa-user"></i><a class="fn" href="' . 
   esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . 
   esc_html(get_the_author()) . '</a></span>' . "\n";
}

but something is not working?

I am trying to add a an acf field called "name" while also adding a css-class to it

the_field('name')

to this code

if ($go_magazine_options['post_meta_author'] === 'enable' && in_the_loop()) {    
    echo '<span class="client">' . get_the_field('name') .
   '<span class="entry-meta-author author vcard"><i class="fa fa-user"></i><a class="fn" href="' . 
   esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . 
   esc_html(get_the_author()) . '</a></span>' . "\n";
}

but something is not working?

Share Improve this question edited Mar 4, 2021 at 17:32 fuxia 107k38 gold badges255 silver badges459 bronze badges asked Mar 4, 2021 at 15:16 Aprilia ParrinoAprilia Parrino 431 gold badge2 silver badges9 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Little Aprilia learns to code ;-) was a silly idea to mix two things, justed added the ACF-Field, using its own if-rule

if( get_field('apri') ): ?>
<span class= "promo"><?php the_field('apri'); ?></span>
<?php endif; 
发布评论

评论列表(0)

  1. 暂无评论