首页 » WordPress » 在下拉菜单中显示分类列表

在下拉菜单中显示分类列表

September 7th, 2008 Denis

有时候,你想在下拉菜单分类列表中显示分类列表,并且不用按提交按钮就能够跳转,最简单的办法就是使用 wp_dropdown_categories 模板标签函数。下面是具体代码:

<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>

翻译自:Most Desired WordPress Hacks: 11 Common Requests and Fixes 第五点。Leojn 也作了翻译。

作者:Denis
原文链接:在下拉菜单中显示分类列表

标签:

分享到 Twitter 分享到 Twitter Delicious 收藏到 Delicious 分享到 Google Reader 分享到 Google Reader 分享到 FriendFeed 分享到 FriendFeed

7 条评论 添加你的评论

Trackbacks/Pingbacks

发表评论

你必须 登陆 之后才能留言。你可以使用以下方式快速登陆我爱水煮鱼:

你也可选择直接在本站 注册


如何学淘宝封百度 wfans.org 插件推荐 2008-09-08


赞助商

 (mt) Media Temple 长期承接 WordPress 项目 WordPress主机合租 用网页模板,当然要选TemplateMonster China 免費資源網路社群 freegroup.org http://p6p9.com/ 在我爱水煮鱼投放广告位

本站推荐

快速导航