开源夏令营(6)

来源:互联网 发布:windows系统常用命令 编辑:程序博客网 时间:2024/05/21 17:52

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');

会输出模板地址的绝对路径

0 0
原创粉丝点击