【发布时间】:2013-05-23 16:02:47
【问题描述】:
编辑:问题是脚本超时。
直到 WordPress 版本 3.2.1 我在网站根目录中名为“list.php”的页面上使用了此代码。当我转到此页面时,会显示指向我在我的网站上发布的所有帖子的永久链接。
安装 WordPress 3.5.1 后,此代码停止工作。我们该如何解决?
<?php
require_once('wp-config.php');
require_once('wp-includes/wp-db.php');
global $post;
$myposts = get_posts('numberposts=-1&offset=1');
foreach($myposts as $post){
echo trim(the_permalink())."<br>";
}
?>
【问题讨论】:
-
您是否尝试将
numberposts更改为posts_per_page? -
我做的不行。
-
但问题是脚本超时,以为我没有解决。
标签: php mysql wordpress wordpress-theming