如何将wordpress帖子评论拉到外部页面
您好,我想知道是否有一种方法可以将帖子上的评论内容从 WordPress 拉到单独的页面。目前这就是我所拥有的,我想用一个函数来替换以拉出评论,而不是拉出评论的链接。
<?php
// Include Wordpress
define('WP_USE_THEMES', false);
require('./blog/wp-load.php');
?>
<div>
<p style="font-size:18px;color:white;font-wieght:700;">Recently Asked Questions</p>
<?php query_posts('showposts=3'); ?>
<?php while (have_posts()): the_post(); ?>
<div id="faq">
<a href="<?php the_permalink() ?>"><?php the_title() ?></a><br />
<?php the_time('F jS, Y') ?>
<?php the_excerpt(); ?>
<?php comments_popup_link(); ?>
To see the answer to the question click <a href="<?php the_permalink() ?>">here</a>.<br /><br />
</div>
<?php endwhile; ?>
</div>
如有任何帮助,我们将不胜感激,谢谢。
Hello I would like to know if there is a way to pull the contents of comments on a post to a separate page from wordpress. currently this is what i have, i'd like to replace with a function to pull the comments instead of pulling the link to the comments.
<?php
// Include Wordpress
define('WP_USE_THEMES', false);
require('./blog/wp-load.php');
?>
<div>
<p style="font-size:18px;color:white;font-wieght:700;">Recently Asked Questions</p>
<?php query_posts('showposts=3'); ?>
<?php while (have_posts()): the_post(); ?>
<div id="faq">
<a href="<?php the_permalink() ?>"><?php the_title() ?></a><br />
<?php the_time('F jS, Y') ?>
<?php the_excerpt(); ?>
<?php comments_popup_link(); ?>
To see the answer to the question click <a href="<?php the_permalink() ?>">here</a>.<br /><br />
</div>
<?php endwhile; ?>
</div>
Any help is appreciated, thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于您正在运行循环,因此您应该能够使用
comments.php
主题文件中的代码。这是一个非常通用的。只需确保将代码放入循环内即可。Since you are running a loop, you should simply be able to use the code from your
comments.php
theme file. Here's a pretty generic one. Just make sure you put the code inside the loop.