zoukankan      html  css  js  c++  java
  • WORDPRESS开发(一)自定义页面显示分类目录

    第一步:
    自定义一个页面,如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’=> ” 用于设置不显示“分类目录”标题,其它的使用默认。

    显示效果如下

    全部代码

    <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>
  • 相关阅读:
    什么是“方法”
    break与continue
    循环结构2
    循环结构1
    Switch多选择结构
    if选择结构
    Scanner方法
    Doc参数信息
    运算符号
    变量与常量
  • 原文地址:https://www.cnblogs.com/imlions/p/4450998.html
Copyright © 2011-2022 走看看