19 04 2011

wordpress get all category list and all post list

bigCat Posted in WordPress - Comment.isBlank
<?php\r\n$category_ids = get_all_category_ids();\r\nforeach ($category_ids as $cat_id) {\r\n$cat_name = get_cat_name($cat_id);?>\r\n\r\n<dl>\r\n<dt>\r\n<a href="<?php echo get_category_link($cat_id);?>"><?php echo $cat_name ?></a>\r\n</dt>\r\n<dd>\r\n<ul>\r\n<?php\r\nwp_reset_query();\r\n$postid = get_the_ID();\r\n$args = array(\r\n'category__in' => array($cat_id),\r\n'showposts' => 255,\r\n);\r\nquery_posts($args);if (have_posts()) : while (have_posts()) : the_post(); ?>\r\n<li><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"<?php if ($postid == get_the_ID()) {echo '';} ?>><?php the_title();?></a></li>\r\n<?php endwhile; else: ?>\r\n<li><p><?php _e('这家伙很懒,什么都没有写.'); ?></p></li>\r\n<?php endif;wp_reset_query();?>\r\n</ul>\r\n</dd>\r\n</dl>\r\n<?php } ?>\r\n

Host: (miao) | Word: Press | Code: HTML5