Some blogs have a lot of categories which they can’t display in their sidebar. Or some bloggers do not want to take up a lot of space displaying categories. This option allows them to have a select menu, dropdown menu, for categories. See WordPress Codex for details.
<form action="<?php bloginfo('url'); ?>/" method="get">
<?php
$select = wp_dropdown_categories('show_option_none=Select Category&show_count=1&orderby=name&echo=0&selected=6');
$select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select);
echo $select;
?>
<noscript><input type="submit" value="View" /></noscript>
</form>
Exclude Certain Categories from Being Displayed in a Loop
Your blog page shows recent posts from all categories. If you want to have a separate page for some reason, or do not want to display certain categories, you can use the following code, and it will exclude a certain category from being displayed in a Loop. Just change the category IDs.
<?php if ( have_posts() ) : query_posts($query_string .'&cat=-13,-26'); while ( have_posts() ) : the_post(); ?>
No comments:
Post a Comment