Created
September 22, 2014 15:57
-
-
Save michaelbrazell/836f529ea4000c2b9cff to your computer and use it in GitHub Desktop.
Looping through a post outside of Wordpress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- This is called in the head of this file --> | |
<?php require('./blog/wp-blog-header.php'); ?> | |
<!-- way down the page --> | |
<div class="feature_blog"> | |
<div class="feature_blog_content"> | |
<h4>The Distance Lens Blog</h4> | |
<?php | |
$args = array( 'numberposts' => '1', 'category' => '1'); | |
$postslist = get_posts( $args); | |
foreach ($postslist as $post) : | |
setup_postdata($post); | |
?> | |
<h3><a href="<?php the_permalink(); ?>" style="color:#cc0033"><?php the_title(); ?></a></h3> | |
<p class="subhead">Posted on <?php the_time(get_option('date_format')) ?></p> | |
<p><?php the_excerpt(); ?> <a href="<?php the_permalink(); ?>" class="cta">> more</a></p> | |
<?php endforeach; ?> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment