我有个问题Advanced Custom Fields Plugin
我创建一个名为的自定义字段:bgcolor
我想在中打印值category.php
, 这是我的代码:
$color = get_field(\'bgcolor\', \'category_\'.the_category_ID( $echo ).\'\');
echo $color;
怎么了?谢谢
我有个问题Advanced Custom Fields Plugin
我创建一个名为的自定义字段:bgcolor
我想在中打印值category.php
, 这是我的代码:
$color = get_field(\'bgcolor\', \'category_\'.the_category_ID( $echo ).\'\');
echo $color;
怎么了?谢谢
我假设您想要当前类别存档的字段,而不是循环中帖子的类别?尝试get_queried_object_id()
而不是the_category_ID( $echo )
.
在里面single.php
, 您只需要对原始尝试进行稍微不同的迭代:
if ( $terms = get_the_category() )
the_field( \'bgcolor\', \'category_\' . $terms[0]->term_id );
使用wp\\U insert\\U post时,我可以执行以下操作:$categories = \'1,2,3,4,5\'...然后。。。\'post_category\' => array($categories)
我有个问题Advanced Custom Fields Plugin
我创建一个名为的自定义字段:bgcolor
我想在中打印值category.php
, 这是我的代码:
$color = get_field(\'bgcolor\', \'category_\'.the_category_ID( $echo ).\'\');
echo $color;
怎么了?谢谢
我假设您想要当前类别存档的字段,而不是循环中帖子的类别?尝试get_queried_object_id()
而不是the_category_ID( $echo )
.
在里面single.php
, 您只需要对原始尝试进行稍微不同的迭代:
if ( $terms = get_the_category() )
the_field( \'bgcolor\', \'category_\' . $terms[0]->term_id );
如何使用以下函数中的短代码将类别放置到页面上。<?php echo get_the_category_list(); ?>