php - How to add posts in wordpress pages? -
i want show posts in homepage of wordpress site..how it??or there plugin can me it?or there shortcodes pull out , display post in homepage?
if want easy way, can use plugin display posts shortcode.
or, if want manually, can use get_posts()
.
here's example use:
<?php if (is_page()) { $cat=get_cat_id($post->post_title); //use page title category id $posts = get_posts ("cat=$cat&showposts=5"); if ($posts) { foreach ($posts $post): setup_postdata($post); ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="permanent link <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <?php endforeach; } } ?>
i hope helps!
Comments
Post a Comment