摘要: 函数 have_posts()函数 描述:判断是否有日志 <?php if(have_posts()){ true }else{ false } the_posts()函数 描述:获取下一篇文章的信息,并将信息存入全局变量$post中 <?php the_posts(); the_title()函数 阅读全文
posted @ 2021-03-09 19:34 Lcxuan27 阅读(266) 评论(0) 推荐(0)
摘要: 顶部模板文件:header.php 底部模板文件:footer.php 函数 get_header()函数 描述:导入header.php模板文件的函数 <?php get_header(); get_footer()函数 描述:导入footer.php模板文件的函数 <?php get_foote 阅读全文
posted @ 2021-03-09 19:28 Lcxuan27 阅读(76) 评论(0) 推荐(0)
摘要: 侧边栏文件:sidebar.php模板文件 函数 get_sidebar()函数 描述:加载sidebar.php模板文件 <?php get_sidebar(); register_sidebar()函数 描述:注册小工具 <?php register_sidebar( array( 'name' 阅读全文
posted @ 2021-03-09 16:59 Lcxuan27 阅读(133) 评论(0) 推荐(0)
摘要: 分类页模板文件:category.php 函数 single_cat_title()函数 描述:获取当前分类的标题 <?php single_cat_title(); get_category_parents()函数 描述:用于获取父分类 get_category_parents( int $id, 阅读全文
posted @ 2021-03-09 16:57 Lcxuan27 阅读(100) 评论(0) 推荐(0)
摘要: 评论模板文件:comments.php 函数 comments_template()函数 描述:调用评论模板文件 <?php comments_template(); comments_open()函数 描述:获取当前文章是否开启评论功能 <?php if(comments_open();){ tr 阅读全文
posted @ 2021-03-09 16:36 Lcxuan27 阅读(72) 评论(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 阅读(103) 评论(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 阅读(166) 评论(0) 推荐(0)
摘要: 函数 register_nav_menus()函数 描述:注册菜单 <?php register_nav_menus( array( 'PrimaryMenu' => '导航', 'firendlinks' => '友情链接', 'footer_nav' => '页脚导航' ) ) wp_nav_m 阅读全文
posted @ 2021-03-09 09:41 Lcxuan27 阅读(252) 评论(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 阅读(46) 评论(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 阅读(89) 评论(0) 推荐(0)
摘要: 函数 get_posts()函数 描述:用于提取多篇指定或随机文章 <?php get_posts( $args ); $args 数组,该函数必要的变量 $args = array( //需要提取的文章数 'numberposts' => 10, //以第几篇文章为起始位置 'offset' => 阅读全文
posted @ 2021-03-09 09:30 Lcxuan27 阅读(355) 评论(0) 推荐(0)
摘要: $wpdb变量 封装好的数据库操作类 存放位置wp-db.php $wpdb->insert() 描述:向数据库中插入一条数据 <?php $wpdb->insert($table,$date,$format); $table 插入的表名 $date 插入的数据,数组格式 $format 可选,插入 阅读全文
posted @ 2021-03-09 09:29 Lcxuan27 阅读(230) 评论(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 阅读(49) 评论(0) 推荐(0)
摘要: 404模板文件:404.php 当输入博客路径的时候,如果访问到了不存在的页面,则会使用默认是模板文件 可以使用404.php来自定义访问不到的404页面 阅读全文
posted @ 2021-03-09 09:21 Lcxuan27 阅读(85) 评论(0) 推荐(0)
摘要: 当前版本:wordpress5.6 首页模板 首页模板:index.php 函数 wp_header()函数 描述:用来控制...之间的标签内容 可以通过header.php模板文件输出html中的head标签部分 <?php wp_head(); ?> wp_footer()函数 描述:用于向浏览 阅读全文
posted @ 2021-03-09 09:15 Lcxuan27 阅读(316) 评论(0) 推荐(0)