【发布时间】:2018-01-14 13:31:16
【问题描述】:
我有一个奇怪的问题,我以前做过很多次同样的事情。 但出于某种原因,这一领域根本不想合作......
<?php if (have_rows('subfamilies_product_changes')) :
while ( have_rows('subfamilies_product_changes') ) : the_row();
$url = the_sub_field('subfamilies_product_changes_link');
echo "<div class='support-lahko'>";
echo "<div class='support-logo'>";
echo the_date( 'Y-m-d' );
echo "</div>";
echo "<div class='news-name-product'>";
echo "<h3 style='vertical-align: middle;'>" . the_sub_field('subfamilies_product_changes_title') ."</h3>";
echo "</div>";
echo "<div class='news-desc'>";
echo "</div>";
echo "</div>";
echo "<br>";
endwhile;
endif;
看来,无论我将<a> 标签放在哪里,这个脚本都会继续运行,并且出于某种原因,将$url = the_sub_field('subfamilies_product_changes_link'); 的链接回显到它所定义的位置。当我尝试做类似<a href=' . $url . '> 之类的事情时,它仍然会在看似随机的地方回显<p> 标签中的url。
这是我将$url 放入href 时发生的情况:
http://imgur.com/a/7AQsl
href 保持为空,而 wp 只是在定义它的地方回显 url。图片中的文字都不是链接。
我只需要将 url 回显到 href 中,这样我就可以将链接迭代到 pdf 文件中。
the_sub_field('subfamilies_product_changes_title')
按预期生成文本:测试更改。
【问题讨论】:
-
你需要使用get_sub_field()
-
..... 哎呀,是的。谢谢
-
没问题的朋友。
-
如果你愿意,你可以把它作为答案提出来
标签: php html wordpress advanced-custom-fields