I’m sort of a noob when it comes to Wordpess; I’ve only recently started building themes and I’ve run into a wall. I’m trying to feature 3 different articles at the top of my site using wpquery and for some reason it’s only displaying one. I’ll include my code below and if anyone can help my figure out what’s wrong I would be very grateful!
Code included in pastebin: http://pastebin.com/1DB7vent
I’m trying to get a setup similar to this:
[div class=”site_width”]
[ul]
[li]
[a h*ref=”FeaturedLink1″]
[i*mg s*rc=”FeaturedLink1 Featured Image]
[/a]
[label]
[a h*ref=”FeaturedLink1″]
“Featured Link Title”
[/a]
[/label]
[/li]
[Repeat format for two more posts]
[/ul]
[/div]
[]’s & *’s included to prevent se from thinking I’m spamming
After calling get_recent_posts() (or any other loop query), you typically have to run a
foreach
orwhile
loop to cycle through the posts. So, you’ll need to change this:to this:
Note that if you’re ever wondering why a WordPress function isn’t working as expected, you can find that function’s entry in the codex and (usually) see an example of use in practice.
http://codex.wordpress.org/Function_Reference/wp_get_recent_posts