How to create a loop in Functions without showing posts.
-
So I’m trying to create a simple list of posts from a certain category and I wanted to put that function in my functions.php so I could just call the short code.
I get the list I want however, I also get the full posts below the list… ? I dont want the posts.
(Also wondering how to get these posts in reverse Chronological order)…
Here is my function:
function getVolArchives() { query_posts('category_name=volunteerspotlights&showposts=12'); echo '<ul style="list-style: none;">'; while (have_posts()) : the_post(); echo '<li style="width: 50%; float: left;"><a href="'. get_permalink() . '"><div style="font-size: 14px; font-weight: bold;">' . get_the_title() . '</div><div class="archiveName">' . get_the_date('F') . '</div></a></li>'; endwhile; echo '</ul>'; } add_shortcode('getVolArchives', 'getVolArchives');
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to create a loop in Functions without showing posts.’ is closed to new replies.