开发者

wordpress include file

开发者 https://www.devze.com 2023-01-15 02:07 出处:网络
I have put some php code in a sidebar-01.php i like in my templa开发者_如何学Pythonte file to get that code

I have put some php code in a sidebar-01.php

i like in my templa开发者_如何学Pythonte file to get that code

How do u do that ? (i don't what to change the code of WP for updating purpose)

i have try include('sidebar-01.php); - it don't work

i like to have a function like : get_header(); for my file, something like : get_file('sidebar-01')

is it possible ?


Go to the 'Theme Editor', look for sidebar.php. Edit it and place this code there:

include('sidebar-01.php');

Also, remember to place your sidebar-01.php in same folder as the other theme .php files (basically your theme folder).


Try the get_sidebar() function defined in wp-includes/general-template.php


If your sidebar file name is sidebar-home.php then call it like this

get_sidebar('home');
0

精彩评论

暂无评论...
验证码 换一张
取 消