记得曾经用过一个WordPress分类目录排序插件,但发现只能够排序侧边栏中的分类目录,无法排序导航栏的分类,关于WordPress导航菜单排序一直是个头疼的问题。
当然,你可以手写HTML,也可以使用WordPress自定义菜单功能排序(3.0以上版本,需主题的支持。) 现在我们就通过分类ID来排序。
首先,我们明白WordPress分类排序的原理:WordPress 文章分类目次的排序默认按照尾字母的英文字母去的,中文汉字是依照第一个汉字的笔划次序来的,分歧范例的排序则顺次是中文汉字–数字–26个英文字母。
其次,找出WordPress分类目录的ID,WordPress再每添加一个分类的时候,都自动为分类添加了一个ID ,所以,通过排序分类ID最为简单。自然,你必须要知道这个分类的ID是多少。方法:进入WordPress后台——分类目录——把鼠标放在你要查看的分类目录上,注意看浏览器地址栏会显示分类的ID 如:edit&cat_id=3
正式开始:修改wp_list_categories函数,在wp-includes/category- template.php中找到
function wp_list_categories( $args = ” ) {
$defaults = array(
‘show_option_all’ => ”, ‘orderby’ => ‘name’,
‘order’ => ‘ASC’, ‘show_last_update’ => 0,
‘style’ => ‘list’, ‘show_count’ => 0,
‘hide_empty’ => 1, ‘use_desc_for_title’ => 1,
‘child_of’ => 0, ‘feed’ => ”, ‘feed_type’ => ”,
‘feed_image’ => ”, ‘exclude’ => ”, ‘exclude_tree’ => ”, ‘current_category’ => 0,
‘hierarchical’ => true, ‘title_li’ => __( ‘Categories’ ),
‘echo’ => 1, ‘depth’ => 0
);
将’show_option_all’ => ”, ‘orderby’ => ‘name’中的orderby’ => ‘name’ 改成’orderby’ => ‘id’ 这样,分类就会自动按照ID来排序了,如果你创建的分类目录的ID顺序刚好是你想要排序的顺序,那就最好了,导航菜单马上就由按名称排序变为按ID排序了!如果不是,那就老老实实重新创建吧,如果已经有了很多内容的站,那就自己去数据库的wp_terms数据表中更改分类的ID吧!
修改中你可能用到的函数
修改中你可能会用到的参数。
orderby 参数
根据某个字段进行排序,参数值 ID | name | count。
<?php wp_list_categories(‘orderby=count’); ?>
3. order
排序方式,升序或降序,参数值:ASC | DESC。
<?php wp_list_categories(‘order=DESC’); ?>
波比源码 » WordPress分类导航排序的方法,无需要插件
order levofloxacin 250mg pills purchase levaquin generic
order avodart 0.5mg pill order zofran for sale order zofran 8mg online
buy spironolactone sale order diflucan 200mg generic fluconazole 100mg generic
ampicillin 500mg oral cephalexin pills erythromycin sale
order fildena online cheap buy sildenafil 100mg generic methocarbamol pills
order sildenafil 100mg suhagra 50mg ca estrace 2mg over the counter
lamotrigine 200mg without prescription buy generic retin tretinoin price
cost tadalis avanafil 200mg without prescription buy voltaren 100mg for sale
indomethacin price order indomethacin 50mg generic buy trimox for sale
cost tadalafil Generic viagra online sildenafil next day
arimidex pills buy biaxin 250mg sale viagra 25mg
cialis 10mg ohne rezept tadalafil 20mg bestellen viagra 200mg für männer
accutane 40mg cost amoxil 1000mg us ivermectin without a doctor prescription
order generic altace 5mg buy avapro 300mg without prescription cheap astelin 10ml
clonidine 0.1mg us minocin 50mg sale order spiriva sale
buspar order online buy cordarone 200mg oxybutynin 2.5mg tablet
terazosin cheap sulfasalazine cost buy generic sulfasalazine 500mg
buy benicar pill order divalproex 500mg generic generic diamox
buy tacrolimus 5mg generic purchase requip for sale order urso 150mg online cheap
sertraline 100mg drug purchase zoloft generic oral sildenafil 50mg
order imuran 100mcg pill purchase sildenafil pills sildenafil 50mg pills
purchase tadalafil pills pfizer viagra online without prescription female viagra
order generic naltrexone cost albenza abilify tablet
buy provera 10mg pill buy praziquantel 600mg online cheap buy periactin 4mg pills
provigil pills stromectol price stromectol medication
isotretinoin 40mg brand cost deltasone 40mg buy deltasone 20mg without prescription
nootropil 800 mg over the counter real viagra pills viagra 100mg
azithromycin 500mg for sale brand azithromycin 500mg order gabapentin 600mg sale
goodrx cialis order tadalafil 5mg sale viagra 100mg usa
order furosemide 40mg online cheap buy hydroxychloroquine 200mg online cheap order plaquenil 400mg for sale
cialis black order clomipramine 50mg buy clomipramine 25mg pills
linezolid 600mg canada slots online online casino real money paypal
order omeprazole 20mg real money blackjack roulette game
buy lopressor for sale atenolol 100mg ca levitra 20mg uk
essays done for you spins real money free online poker games
clomiphene buy online best online gambling sites free online slot machines
order aristocort 10mg without prescription clarinex 5mg price cost desloratadine 5mg
purchase dapoxetine generic buy dapoxetine 90mg generic order synthroid 75mcg online
purchase xenical online buy zovirax generic zovirax usa
sumatriptan pills sumatriptan 25mg over the counter avodart for sale online
cheap colchicine generic colchicine slots casino
ranitidine buy online purchase celecoxib celebrex pills
tamsulosin over the counter purchase tamsulosin for sale brand spironolactone
cialis 20mg oral buy cipro without prescription ciprofloxacin 500mg pill
buy flagyl 400mg online metronidazole price bactrim 480mg us
ceftin 500mg without prescription purchase careprost buy robaxin without prescription
casino online cheap tadalafil 10mg tadalafil 10mg pill
deltasone over the counter generic accutane 40mg buy amoxicillin 1000mg sale
order sildenafil 100mg online viagra for men over 50 tadalafil 5mg pill
lasix brand doxycycline 200mg oral brand hydroxychloroquine 200mg
sildenafil 50mg tablet buy budesonide for sale buy generic rhinocort
lamisil medication cheap cefixime amoxicillin pills
naprosyn brand order naproxen 500mg prevacid 30mg us
proventil 100mcg for sale buy cipro sale buy generic cipro 1000mg
buy cialis 20mg sale Cialis sales order tadalafil 5mg pill
buy stromectol 2mg order stromectol 3mg sale dapsone 100 mg ca
order adalat 10mg for sale buy perindopril 4mg online cheap fexofenadine 180mg over the counter
online gambling for real money burton brunette online casinos usa
ramipril 10mg without prescription order ramipril for sale etoricoxib 60mg for sale
purchase mesalamine generic asacol drug order irbesartan 300mg without prescription
clobetasol canada order temovate generic cordarone without prescription
order diamox 250 mg without prescription imuran 50mg pill imuran 50mg brand
lanoxin price digoxin 250 mg pills buy molnupiravir 200mg generic
buy amoxicillin 1000mg without prescription cheap amoxicillin without prescription ivermectin 6 mg tablet
buy fosamax 35mg sale furadantin 100mg us order ibuprofen 600mg generic
generic dapoxetine brand avana 100mg buy motilium 10mg generic
indomethacin 50mg uk order flomax 0.2mg online cheap buy cenforce for sale
ropinirole 1mg over the counter ropinirole for sale online trandate 100mg us
order tadacip 10mg plavix 75mg us buy amoxicillin for sale
buy nexium sale buy clarithromycin 500mg without prescription lasix 100mg generic
minocycline 100mg usa order minocin 100mg online cheap hytrin 5mg pills
buy glucophage generic order calan 240mg online cheap tamoxifen drug
order clomid 100mg without prescription order prednisolone 10mg sale buy prednisolone online cheap
purchase prednisone generic order generic deltasone 10mg buy generic amoxicillin 1000mg
sildenafil 50mg uk purchase lyrica generic order proscar 5mg without prescription
ivermectin 12mg tablets deltasone 40mg tablet prednisone 20mg cost
order ondansetron 8mg cost amoxicillin 500mg generic sulfamethoxazole
order accutane 10mg without prescription amoxil 500mg pill order azithromycin 250mg generic
modafinil order online order modafinil 100mg buy metoprolol generic
buy dutasteride for sale buy avodart 0.5mg orlistat uk
buy imuran 50mg generic naproxen 250mg usa naproxen 500mg cheap