Display Title and Excerpt on a page outside of WordPress
-
I think the way that I need to do this is to create a file that would write the title and excerpt of a post to a file that I could then include from another page, but I’ve tried a couple of ways to do that and am not having any luck?!
I want just the title and excerpt without any of the surrounding template-
I came up with this code that I think is right:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h2><?php the_title(); ?></h2><br />
<?php _e("Posted on "); ?><?php the_time('l j F Y',display); ?><?php the_excerpt(); ?>
<?php endwhile; else: ?><br />
<?php _e('Sorry, no posts matched your criteria.'); ?><br />
<?php endif; ?>but I’m not sure where to put it?- any help or better way of doing this?
- The topic ‘Display Title and Excerpt on a page outside of WordPress’ is closed to new replies.