我想使用可以检索所有文章的所有URL的机制/ API。理想情况下,我想在许多平台上完成它,但它足以开始使用wordpress.org和blogspot.com。
我该怎么做?
答案 0 :(得分:0)
来自Wordpress codex ....
<ul>
<?php
// post_per_page value = number of total posts...
$args = array( 'posts_per_page' => 9999999, 'offset'=> 1 );
$myposts = get_posts( $args );
foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</li>
<?php endforeach;
wp_reset_postdata();?>
</ul>
在此示例中,您需要使用get_permalink();而不是the_permalink将URL作为字符串..