Advanced Theme Development With Bootstrap

Bobby
2026-10-06 / 0 评论 / 14 阅读 / 正在检测是否收录...

这篇文章介绍使用vscode开发Wordpress主题开发的全流程。
通常来说Wordpress的开发分为以下几个体系。
关注整体的项目结构:请看这篇文章 LocalWP项目结构
主题CSS文件以及主题略缩图的修改:请看这篇文章 Style.css撰写及主题封面
Index.php的完善和header及footer整理:请看这篇文章 index.php header及footer整理
function.php的文章撰写:请看这篇文章 function.php
菜单注册及调用:请看这篇文章 菜单注册及调用
响应式设置:请看这篇文章 移动端响应式设置
页面创建:请看这篇文章 页面创建
主题支持函数: 请看这篇文章 主题支持函数
Sidebar侧边栏开发:请看这篇文章 Sidebar侧边栏开发
WP Query查询类: 请看这篇文章 WP Query查询类
Single.php:请看这篇文章

调用header主题图片,代码:

调用主题略缩图函数 <?php the_post_thumbnail(thumb/meduim/large/full/array(275,380));?>
调整略缩图大小尺寸 setting下 去找

调用logo图片 <?php the_custom_logo();>

WP Query查询类

添加链接 permalink

<?php the_permalink();?>

single.php

<?php get_header() ?>

<?php get_footer() ?>

搜索

直接调用函数
<?php get_search_form(); ?>

创建文件,search.php

Theme Customizer

页脚版权信息

wp-devs文件夹下建立一个inc文件夹
创建一个customizer.php
下一步,在functions.php中,头顶写一段
require get_template_directory_uri().'/inc/customizer.php';

写在 customizer.php
<?php
function wpdevs_customize($wp_customize){

// 1 Coryright Section
$wp_customize -> add_section(
   'sec_copyright',
   array(
   'title' => 'Copyright Settings',
   'description' => 'Copyright Settings'
   )
);
$wp_customize -> add_setting(

)

}

0

评论 (0)

取消