第一次打开帖子,迫切需要一些帮助。
这个问题可能非常简单(最有可能),但我无法弄清楚过去 2 天一直在尝试。
因此,我在我的 wordpress 站点中创建了一个新的自定义帖子类型,并且正在为存档创建模板,您将在其中看到所有已创建的帖子。
这是我想让帖子标题显示的问题(工作正常),但也是帖子本身的链接。我知道有 the_shortlink(); 这工作得很好,但我希望帖子本身的标题是链接。
在它下面将是一些写在正文中的文本,有点像帖子内部内容的预览。据我所知,我可以使用 the_excerpt(); 如果这也是错误的,请告诉我。
//Some CSS this is not important atm
<div class="aa-div">
<?
if(have_posts()) : while(have_posts()) : the_post();
the_title();
the_shortlink();
echo '<div class="entry-content">';
the_content();
echo '</div>';
endwhile; endif; ?>
</div>
希望你有一个美好的一天和一个快乐的新年。
您可以使用以下代码
the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' );
代替
the_title();
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句