随笔分类 -  wordpress

1
主要用于学习wordpress时做笔记
摘要:函数 have_posts()函数 描述:判断是否有日志 <?php if(have_posts()){ true }else{ false } the_posts()函数 描述:获取下一篇文章的信息,并将信息存入全局变量$post中 <?php the_posts(); the_title()函数 阅读全文
posted @ 2021-03-09 19:34 Lcxuan27 阅读(272) 评论(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 阅读(78) 评论(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 阅读(134) 评论(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 阅读(101) 评论(0) 推荐(0)
摘要:评论模板文件:comments.php 函数 comments_template()函数 描述:调用评论模板文件 <?php comments_template(); comments_open()函数 描述:获取当前文章是否开启评论功能 <?php if(comments_open();){ tr 阅读全文
posted @ 2021-03-09 16:36 Lcxuan27 阅读(73) 评论(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 阅读(109) 评论(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 阅读(171) 评论(0) 推荐(0)
摘要:函数 register_nav_menus()函数 描述:注册菜单 <?php register_nav_menus( array( 'PrimaryMenu' => '导航', 'firendlinks' => '友情链接', 'footer_nav' => '页脚导航' ) ) wp_nav_m 阅读全文
posted @ 2021-03-09 09:41 Lcxuan27 阅读(253) 评论(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 阅读(47) 评论(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 阅读(359) 评论(0) 推荐(0)
摘要:$wpdb变量 封装好的数据库操作类 存放位置wp-db.php $wpdb->insert() 描述:向数据库中插入一条数据 <?php $wpdb->insert($table,$date,$format); $table 插入的表名 $date 插入的数据,数组格式 $format 可选,插入 阅读全文
posted @ 2021-03-09 09:29 Lcxuan27 阅读(236) 评论(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 阅读(50) 评论(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 阅读(317) 评论(0) 推荐(0)
摘要:当前版本:wordpress5.6 主题存放位置 wordpress的主题主要存放在根目录->wp-content文件夹->themes文件夹下面 安装完成wordpress后会自动内置三个系统的主题 主题创建 在主题的存放位置下创建个文件夹,名字可以自定义 在上面创建的文件夹里面新建个index. 阅读全文
posted @ 2021-03-08 18:56 Lcxuan27 阅读(285) 评论(0) 推荐(0)
摘要:当前版本:wordpress5.6 下载地址:https://cn.wordpress.org/download/ 下载完成后,将压缩包解压放到自己的根目录,接着进入页面 进入页面后会出现选择的语言,往下拉选择“简体中文” 接着会出现准备wordpress一些信息,选择“现在就开始!” 接着会出现需 阅读全文
posted @ 2021-03-08 18:38 Lcxuan27 阅读(88) 评论(0) 推荐(1)
摘要:主题模板文件加载过程 根目录下的index.php为首页的入口文件 index.php加载了wp-blog-header.php,wp-blog-header.php加载了wp-load.php和template-loader.php 阅读全文
posted @ 2021-03-08 18:13 Lcxuan27 阅读(143) 评论(0) 推荐(0)
摘要:版本:wordpress5.6 wordpress数据库结构 以“lcx_”开头的为数据库的前缀,这个是在安装wordpress时自定义的 文章评论信息 xxx_commentmeta 文章评论额外信息表 xxx_comments 文章评论信息表 链接信息 xxx_links 链接信息表 主要用来存 阅读全文
posted @ 2021-03-08 17:41 Lcxuan27 阅读(125) 评论(0) 推荐(0)
摘要:使用版本:wordpress5.6 wordpress5.6源文件结构分析 源文件结构 wp-admin文件夹 存放后台管理需要的类和文件 wp-content文件夹 默认的用户内容目录 wp-includes文件夹 WordPress强大的类库,及核心函数定义 index.php文件 WordPr 阅读全文
posted @ 2021-03-08 17:35 Lcxuan27 阅读(194) 评论(0) 推荐(0)

1