摘要: 分类页模板文件:category.php 函数 single_cat_title()函数 描述:获取当前分类的标题 <?php single_cat_title(); get_category_parents()函数 描述:用于获取父分类 get_category_parents( int $id, 阅读全文
posted @ 2021-03-09 16:57 Lcxuan27 阅读(98) 评论(0) 推荐(0)
摘要: 评论模板文件:comments.php 函数 comments_template()函数 描述:调用评论模板文件 <?php comments_template(); comments_open()函数 描述:获取当前文章是否开启评论功能 <?php if(comments_open();){ tr 阅读全文
posted @ 2021-03-09 16:36 Lcxuan27 阅读(67) 评论(0) 推荐(0)
摘要: 文章页模板文件:single.php 独立页面模板:page.php 函数 previous_post_link()函数 描述:上一篇文章链接 previous_post_link( string $format = '&laquo; %link', string $link = '%title', 阅读全文
posted @ 2021-03-09 10:00 Lcxuan27 阅读(99) 评论(0) 推荐(0)
摘要: 搜索页模板文件:search.php 自定义搜索框文件:searchform.php 函数 get_search_query()函数 描述:获取搜索词 <?php echo get_search_query(); get_search_form()函数 描述:引入searchform.php来显示搜 阅读全文
posted @ 2021-03-09 09:54 Lcxuan27 阅读(163) 评论(0) 推荐(0)
摘要: 函数 register_nav_menus()函数 描述:注册菜单 <?php register_nav_menus( array( 'PrimaryMenu' => '导航', 'firendlinks' => '友情链接', 'footer_nav' => '页脚导航' ) ) wp_nav_m 阅读全文
posted @ 2021-03-09 09:41 Lcxuan27 阅读(251) 评论(0) 推荐(0)
摘要: 面包屑导航 <?php if(is_category()){ single_Cat_title() }elseif(is_search()){ //$s为搜索的关键词 echo $s }elseif(is_single()){ $cat = get_the_category(); $cat = $c 阅读全文
posted @ 2021-03-09 09:37 Lcxuan27 阅读(45) 评论(0) 推荐(0)
摘要: 函数 is_home()函数 描述:是否在首页 <?php if(is_home()){ true }else{ flase } wp_title()函数 描述:自定识别模板,返回对应标题 <?php wp_title($sep,$echo,$sqplocation); $sep 分隔符 $echo 阅读全文
posted @ 2021-03-09 09:33 Lcxuan27 阅读(86) 评论(0) 推荐(0)
摘要: 函数 get_posts()函数 描述:用于提取多篇指定或随机文章 <?php get_posts( $args ); $args 数组,该函数必要的变量 $args = array( //需要提取的文章数 'numberposts' => 10, //以第几篇文章为起始位置 'offset' => 阅读全文
posted @ 2021-03-09 09:30 Lcxuan27 阅读(348) 评论(0) 推荐(0)
摘要: $wpdb变量 封装好的数据库操作类 存放位置wp-db.php $wpdb->insert() 描述:向数据库中插入一条数据 <?php $wpdb->insert($table,$date,$format); $table 插入的表名 $date 插入的数据,数组格式 $format 可选,插入 阅读全文
posted @ 2021-03-09 09:29 Lcxuan27 阅读(226) 评论(0) 推荐(0)
摘要: 函数 has_post_thumbnail()函数 描述:通过ID判断文章是否有缩略图 <?php has_post_thumbnail($post_id); $post_id 【可选,文章ID】 the_post_thumbnail()函数 描述:显示当前日志的缩略图 <?php the_post 阅读全文
posted @ 2021-03-09 09:26 Lcxuan27 阅读(47) 评论(0) 推荐(0)