View tag description on page

时间:2017-12-15 作者:Michał Misiek

除了标记描述之外,其他一切都正常。你能帮忙吗?

<?php while($my_Property->have_posts()) : $my_Property->the_post(); ?>
    <div class="ListaP" style="width:32%; display: inline-block;">
        <div class="Lista">
            <h4><?php the_title(\'\'); ?></h4>
            <div class="thumbnail lista"
            <p class="propertyID" style="font-weight:600;">ID: <?php $post_url = get_the_ID($post_id); echo $post_url; ?></p>
            <p class="opisOdAgenta">ADRES: <?php the_field(\'deal_title\'); ?></p>
            <p class="adresAgent">NOTATKI/UWAGI/: <?php the_field(\'deal_detail\'); ?></p>
            <p class="klientWlasciciel">KTO PROWADZI: <?php the_author(); ?></p> 
            <p class="klientWlasciciel">WLASCICIEL: <?php echo \'Tag Description: \' . tag_description($tag_id); ?> </p>  //DOESNT WORK
            </div>

        </div>

    </div>
<?php endwhile;?>

1 个回复
SO网友:jdm2112

你的$tag_id 使用前未定义变量。尝试使用其中的固定值进行测试:

<p class="klientWlasciciel">WLASCICIEL: <?php echo \'Tag Description: \' . tag_description( \'1\' ); ?> </p>
。。。或测试默认行为,该行为应为当前查询的标记:

<p class="klientWlasciciel">WLASCICIEL: <?php echo \'Tag Description: \' . tag_description(); ?> </p>

https://codex.wordpress.org/Function_Reference/tag_description

结束