List posts on an external page
-
Hi there,
I am developing a website at https://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="https://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
- The topic ‘List posts on an external page’ is closed to new replies.