第一步:
自定义一个页面,如index.php

第二步:
打开index.php文件,引用wp-blog-header.php文件

require('wp-blog-header.php');

第三步
使用wp_list_categories提取分类

$args=array('title_li'=> '');
wp_list_categories($args);

‘title_li’=> ” 用于设置不显示“分类目录”标题,其它的使用默认。

显示效果如下

WORDPRESS开发(一)自定义页面显示分类目录

全部代码

<style type="text/css">
    body{
        font-size:16px;
        font-family: 微软雅黑;
    }
    .categories{
        list-style: none;
        padding:0;
    }
    .categories li{
        list-style:none;
    }
    .categories a{
        text-decoration: none;

    }
    .categories a:hover{
        text-decoration: underline;
    }
</style>
<ul class="categories">
<?php 
require('wp-blog-header.php');

$args=array('title_li'=> '');
wp_list_categories($args);
?>
</ul>

 

相关文章:

  • 2021-08-19
  • 2021-10-15
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
  • 2023-03-03
  • 2022-12-23
  • 2021-09-02
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-18
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案