WordPress开发教程:如何删除文章列表的评论和标签列,并且重新排列作者和分类目录列

前端之家收集整理的这篇文章主要介绍了WordPress开发教程:如何删除文章列表的评论和标签列,并且重新排列作者和分类目录列前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

在使用wordpress进行开发的过程中,很多时候我们想删除文章列表页面的某个列(例如评论标签列),或者重新排列列的顺序(颠倒作者和分类目录列),如下图:

column

这篇wordpress教程里我们就向大家介绍一下具体的方法

切换到模板目录,打开functions.PHP文件,加入以下代码

Crayon-5c891d1a0701f370549883" class="Crayon-Syntax Crayon-theme-classic Crayon-font-monaco Crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouSEOver" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
Crayon-toolbar" data-settings=" mouSEOver overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">Crayon-title">
Crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
Crayon-button Crayon-nums-button" title="Toggle Line Numbers">
Crayon-button-icon">
Crayon-button Crayon-plain-button" title="Toggle Plain Code">
Crayon-button-icon">
Crayon-button Crayon-wrap-button" title="Toggle Line Wrap">
Crayon-button-icon">
Crayon-button Crayon-expand-button" title="Expand Code">
Crayon-button-icon">
Crayon-button Crayon-copy-button" title="Copy">
Crayon-button-icon">
Crayon-button Crayon-popup-button" title="Open Code In New Window">
Crayon-button-icon">
Crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-plain-wrap">
Crayon-main" style="">Crayon-table">Crayon-row">
Crayon-nums " data-settings="show">
Crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
Crayon-num" data-line="Crayon-5c891d1a0701f370549883-1">1
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d1a0701f370549883-2">2
Crayon-num" data-line="Crayon-5c891d1a0701f370549883-3">3
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d1a0701f370549883-4">4
Crayon-num" data-line="Crayon-5c891d1a0701f370549883-5">5
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d1a0701f370549883-6">6
Crayon-num" data-line="Crayon-5c891d1a0701f370549883-7">7
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d1a0701f370549883-8">8
Crayon-num" data-line="Crayon-5c891d1a0701f370549883-9">9
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d1a0701f370549883-10">10
Crayon-num" data-line="Crayon-5c891d1a0701f370549883-11">11
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d1a0701f370549883-12">12
Crayon-num" data-line="Crayon-5c891d1a0701f370549883-13">13
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d1a0701f370549883-14">14
Crayon-num" data-line="Crayon-5c891d1a0701f370549883-15">15
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d1a0701f370549883-16">16
Crayon-num" data-line="Crayon-5c891d1a0701f370549883-17">17
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d1a0701f370549883-18">18
Crayon-code">
Crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
Crayon-line" id="Crayon-5c891d1a0701f370549883-1">Crayon-t">functionCrayon-h"> Crayon-e">my_manage_columnsCrayon-sy">(Crayon-h"> Crayon-sy">$Crayon-i">columnsCrayon-h"> Crayon-sy">)Crayon-h"> Crayon-sy">{
Crayon-line Crayon-striped-line" id="Crayon-5c891d1a0701f370549883-2">Crayon-h"> Crayon-e">unsetCrayon-sy">(Crayon-sy">$Crayon-v">columnsCrayon-sy">[Crayon-s">'tags'Crayon-sy">]Crayon-sy">)Crayon-sy">;
Crayon-line" id="Crayon-5c891d1a0701f370549883-3">Crayon-h"> Crayon-e">unsetCrayon-sy">(Crayon-sy">$Crayon-v">columnsCrayon-sy">[Crayon-s">'comments'Crayon-sy">]Crayon-sy">)Crayon-sy">;
Crayon-line Crayon-striped-line" id="Crayon-5c891d1a0701f370549883-4">Crayon-h"> Crayon-sy">$Crayon-v">authorCrayon-o">=Crayon-sy">$Crayon-v">columnsCrayon-sy">[Crayon-s">'author'Crayon-sy">]Crayon-sy">;
Crayon-line" id="Crayon-5c891d1a0701f370549883-5">Crayon-h"> Crayon-sy">$Crayon-v">categoriesCrayon-o">=Crayon-sy">$Crayon-v">columnsCrayon-sy">[Crayon-s">'categories'Crayon-sy">]Crayon-sy">;
Crayon-line Crayon-striped-line" id="Crayon-5c891d1a0701f370549883-6">Crayon-h"> Crayon-sy">$Crayon-v">dateCrayon-o">=Crayon-sy">$Crayon-v">columnsCrayon-sy">[Crayon-s">'date'Crayon-sy">]Crayon-sy">;
Crayon-line" id="Crayon-5c891d1a0701f370549883-7">Crayon-h"> Crayon-e">unsetCrayon-sy">(Crayon-sy">$Crayon-v">columnsCrayon-sy">[Crayon-s">'author'Crayon-sy">]Crayon-sy">)Crayon-sy">;
Crayon-line Crayon-striped-line" id="Crayon-5c891d1a0701f370549883-8">Crayon-h"> Crayon-e">unsetCrayon-sy">(Crayon-sy">$Crayon-v">columnsCrayon-sy">[Crayon-s">'categories'Crayon-sy">]Crayon-sy">)Crayon-sy">;
Crayon-line" id="Crayon-5c891d1a0701f370549883-9">Crayon-h"> Crayon-e">unsetCrayon-sy">(Crayon-sy">$Crayon-v">columnsCrayon-sy">[Crayon-s">'date'Crayon-sy">]Crayon-sy">)Crayon-sy">;
Crayon-line Crayon-striped-line" id="Crayon-5c891d1a0701f370549883-10">Crayon-h"> Crayon-sy">$Crayon-v">columnsCrayon-sy">[Crayon-s">'categories'Crayon-sy">]Crayon-h"> Crayon-o">=Crayon-h"> Crayon-sy">$Crayon-v">categoriesCrayon-sy">;
Crayon-line" id="Crayon-5c891d1a0701f370549883-11">Crayon-h"> Crayon-sy">$Crayon-v">columnsCrayon-sy">[Crayon-s">'author'Crayon-sy">]Crayon-h"> Crayon-o">=Crayon-h"> Crayon-sy">$Crayon-v">authorCrayon-sy">;
Crayon-line Crayon-striped-line" id="Crayon-5c891d1a0701f370549883-12">Crayon-h"> Crayon-sy">$Crayon-v">columnsCrayon-sy">[Crayon-s">'date'Crayon-sy">]Crayon-h"> Crayon-o">=Crayon-h"> Crayon-sy">$Crayon-v">dateCrayon-sy">;
Crayon-line" id="Crayon-5c891d1a0701f370549883-13">Crayon-h"> Crayon-st">returnCrayon-h"> Crayon-sy">$Crayon-v">columnsCrayon-sy">;
Crayon-line Crayon-striped-line" id="Crayon-5c891d1a0701f370549883-14">Crayon-sy">}
Crayon-line" id="Crayon-5c891d1a0701f370549883-15">Crayon-t">functionCrayon-h"> Crayon-e">my_column_initCrayon-sy">(Crayon-sy">)Crayon-h"> Crayon-sy">{
Crayon-line Crayon-striped-line" id="Crayon-5c891d1a0701f370549883-16">Crayon-h"> Crayon-e">add_filterCrayon-sy">(Crayon-h"> Crayon-s">'manage_posts_columns'Crayon-h"> Crayon-sy">,Crayon-h"> Crayon-s">'my_manage_columns'Crayon-h"> Crayon-sy">)Crayon-sy">;
Crayon-line" id="Crayon-5c891d1a0701f370549883-17">Crayon-sy">}
Crayon-line Crayon-striped-line" id="Crayon-5c891d1a0701f370549883-18">Crayon-e">add_actionCrayon-sy">(Crayon-h"> Crayon-s">'admin_init'Crayon-h"> Crayon-sy">,Crayon-h"> Crayon-s">'my_column_init'Crayon-h"> Crayon-sy">)Crayon-sy">;

赶紧测试一下上面的代码吧,您也可以根据实际情况做些调整。

原文链接:https://www.f2er.com/wordpress/238458.html

猜你在找的wordpress相关文章