0
下面的代码在黑色文本中显示标题,然后显示带有超链接的蓝色标题。我的WP LOOP脚本中的ghost post_title
我只希望链接出现。
if ($query2->have_posts()) {
// The 2nd Loop
while ($query2->have_posts()) {
$query2->the_post();
if ($post->ID == $do_not_duplicate)
continue;
$permalink = get_the_permalink($query2->post->ID);
$ID = $post->ID;
$titleAtribute = the_title_attribute();
$title = get_the_title();
echo '<h2 id="post-' .$ID.' ">
<a href="'.$permalink.'" rel="bookmark" title="Permanent Link to '.$permalink.' ">
'.$title.'</a></h2>';
}
// Restore original Post Data
wp_reset_postdata();
}
例如,在我的网站:http://skkelti.cz/,下面的文本显示在黑色的文字相同上面的链接:
-MartinDavídek毫升。 :“Fanoušcijsouvždy来,共同输精管ženekupředu” -
,其中从该来了,我该怎么需要做什么来阻止出现呢?
好吧,如果我不打算显示它,为什么我被推迟在代码中? :O感谢您的建议 – ragulin
你不想立即显示它* - 这就是现在发生的事情。你想要做的是获取值并将其保存在名为'$ titleAtribute'的变量中,以便您可以随时使用它来显示它。它就像'$ title = get_the_title();' - 你不会在屏幕上显示那个,你将它保存到'$ title'变量中,然后在下一行使用'$ title'创建链接。 (你实际上并没有在你包含的代码中使用'$ titleAtribute',但也许你会在其他地方使用它)。 – FluffyKitten