get_posts help
-
I’ve been trying the examples on the get_posts help page, but each of these seems to break my page.
Currently I’m hard linking to posts in my ‘Article’ category on my content page. I was doing this because some were posts, and some were pages, but I have now converted all the pages to posts.
I would now like to be to stop editing the page each time I want another link, and simply display a list of links, in alphabetical order.
I’ve got the php plugin installed, and other WP template tags are working on the page – my list of all categories and list of posts by time.
I thoguht it would simply be a matter of using get_posts(), setting the category to 2 and letting it display the links, such as the first example:
-
<?php
- “><?php the_title(); ?> — <?php the_excerpt(); ?>
$myposts = get_posts(‘numberposts=5&offset=1&category=1’);
foreach($myposts as $post) :
?><?php endforeach; ?>
But when I inlcude this in my page, my page breaks and it displays nothing after the header.
The topic ‘get_posts help’ is closed to new replies.