List posts on an external page
-
Hi there,
I am developing a website at http://sixclicks.phillipvale.com.au/.
I want the text widget with iframe in the sidebar to pull through a page that i am building that will show recent posts, popular posts and comment with a simple div toggle at the top of it.
<iframe width="100%" height="auto" src="http://sixclicks.phillipvale.com.au/wp-content/themes/six-clicks/subscribe.php" scrolling="no"></iframe>I thought it would involve a simple get_post…
<ul> <?php $args = array( 'posts_per_page' => 5, 'offset'=> 1, 'category' => 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>But throws up Fatal error: Call to undefined function get_posts() in /home/phph6409/public_html/sixclicks/wp-content/themes/six-clicks/recent-popular-comments.php on line 58.
Is the problem that I am trying to operate outside of the loop?
Thanks, any help is much appreciated!
Phillustration
-
Thanks Alchymyth,
This looks like it should work. I read the article that you sent through but still nothing posts. However, it doesn’t throw up an error either.
<?php require('http://sixclicks.phillipvale.com.au/wp-blog-header.php'); ?> <?php $posts = get_posts('numberposts=10&order=ASC&orderby=post_title'); foreach ($posts as $post) : setup_postdata( $post ); ?> <?php the_date(); echo "<br />"; ?> <?php the_title(); ?> <?php the_excerpt(); ?> <?php endforeach; ?>Help please!
Thanks,
Phil
Still can’t seem to get this work. Does anyone out there know of a plugin that just does what I need?
The topic ‘List posts on an external page’ is closed to new replies.