Professional Documents
Culture Documents
=======================================
Display recent posts without pagination
=======================================
<main id="main" class="site-main col-sm-9 col-md-9 blog-entries" role="main">
<?php query_posts('cat=#&posts_per_page=5'); ?>
<?php while (have_posts()) : the_post(); ?>
<div class="row">
<div class="col-sm-4 col-md-4">
<a href="<?php echo get_permalink(); ?>">
<?php the_post_thumbnail(); ?>
</a>
</div>
<div class="col-sm-8 col-md-8">
<h4><a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a></
h4>
<p class="entry-meta"><?php billiant_designs_posted_on(); ?> by <?php ec
ho get_the_author_link(); ?></p>
<?php the_content_limit(150); ?><!--this needs a plugin-->
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</main><!-- #main -->
======================================================
Display the Most Recent Posts from a Specific Category
======================================================
The code below will show 1 post with the excerpt from category 3:
<?php
query_posts('showposts=1&cat=3');
while(have_posts()) : the_post();
?>
<ul>
<li><h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?><
/a></h3>
<ul><li><?php the_excerpt(); ?></li>
</ul>
</li>
</ul>
<?php endwhile; ?>
To only show links from the category use the code below:
<?php
query_posts('showposts=1&cat=3');
while(have_posts()) : the_post();
?>
<ul>
<li><h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?><
/a></h3>
</li>
</ul>
<?php endwhile; ?>