WordPress主题2
1.创建头文件header.php;
记得添加
<?php wp_head();?>
在
</head>
之前;
2.创建脚步文件footer.php;
记得添加
<?php wp_footer(); ?>
在
</body>
之前;
3.javascript文件的两种引入方式;
方式1:
<script src="<?php bloginfo('template_url');?>/js/jquery.js"></script>
(一般可行)
方式2:
wp_enqueue_script( 'init_js',get_bloginfo('template_url').'/js/init.js');
(更专业)
4.css文件的两种引入方式;
方式1:
<link rel="stylesheet" href="<?php bloginfo('template_url');?>/css/style-wide.css" />
(一般可行)
方式2:
wp_enqueue_style( 'init_style',get_bloginfo('template_url').'/css/mystyle.css');
(更专业)
5.通过
get_header()
和
get_footer()
包含头尾文件;
6.
bloginfo('template_url');
会输出模板地址的绝对路径