How do I finish this function?
-
Howdy wordpressers!
I’m a bit stuck. My php isn’t that amazing but I have managed to cobble together the basics of a function to show a specific number of posts from a specific category on a apge, using a shortcode.
Here is my php wizardry so far –
// Show posts shortcode function scShowPosts($atts) { extract(shortcode_atts(array( 'category' => 0, 'number' => 0 ), $atts)); return "Hello World<br />" . $category . "<br />" . $number . "<br />"; query_posts('category_name=' . $category . '&number=' . $number ); while (have_posts()) : the_post(); // What goes here? endwhile; } add_shortcode("showposts", "scShowPosts");
Now, I’m not sure if some sort of version of ‘the loop’ will fit in there or not, or even if that would work from the functions.php file.
Can anyone give me a poke in the right direction?
Thanks ??
- The topic ‘How do I finish this function?’ is closed to new replies.