Php wordpress包含文件
我在侧边栏01.php中放了一些php代码 我喜欢在我的模板文件中获取代码 你是怎么做到的?(我不知道如何更改WP的代码以进行更新) 我尝试了include('sidebar-01.php);-它不起作用 我喜欢有一个函数,比如:get_header();对于我的文件,类似于:get_file('sidebar-01')Php wordpress包含文件,php,wordpress,function,Php,Wordpress,Function,我在侧边栏01.php中放了一些php代码 我喜欢在我的模板文件中获取代码 你是怎么做到的?(我不知道如何更改WP的代码以进行更新) 我尝试了include('sidebar-01.php);-它不起作用 我喜欢有一个函数,比如:get_header();对于我的文件,类似于:get_file('sidebar-01') 可能吗?试试wp includes/general template.php中定义的get_sidebar()函数转到“主题编辑器”,查找sidebar.php。编辑它并将此代
可能吗?试试
wp includes/general template.php中定义的get_sidebar()
函数
转到“主题编辑器”,查找sidebar.php。编辑它并将此代码放在那里:
include('sidebar-01.php');
另外,请记住将您的
sidebar-01.php
与其他theme.php文件(基本上是您的theme文件夹)放在同一个文件夹中。如果您的sidebar文件名为sidebar home.php
,请这样调用它
get_sidebar('home');