admin管理员组文章数量:1388067
I want to call Servicedeneme.php which is in main folder of theme, in mysite/faq/
It's title is FAQ so I write code for two form which are faq and FAQ.However, it doesnt work.
I write below code to function.php
if (is_page( 'faq' ) or is_page( 'FAQ' )) {
get_template_part( 'Servicedeneme' );
}
Also when I write below code, wp will error:
function show_archieve_styles(){
if (is_page( 'faq' ) or is_page( 'FAQ' )) {
get_template_part( 'Servicedeneme' );
}
}
add_action('wp', 'show_archieve_style');
It says there is no function in error.
So, whats the problem?
I want to call Servicedeneme.php which is in main folder of theme, in mysite/faq/
It's title is FAQ so I write code for two form which are faq and FAQ.However, it doesnt work.
I write below code to function.php
if (is_page( 'faq' ) or is_page( 'FAQ' )) {
get_template_part( 'Servicedeneme' );
}
Also when I write below code, wp will error:
function show_archieve_styles(){
if (is_page( 'faq' ) or is_page( 'FAQ' )) {
get_template_part( 'Servicedeneme' );
}
}
add_action('wp', 'show_archieve_style');
It says there is no function in error.
So, whats the problem?
Share Improve this question asked May 4, 2020 at 3:20 ahmet kayaahmet kaya 331 silver badge9 bronze badges 2 |1 Answer
Reset to default 0Are you wanting to replace the template file for the entire page or include a certain feature? As @JacobPeattie mentioned in the comments you may want to check out template hierarchy for replacing the whole template.
The get_template_part() function can be used to include a template part into another file. I think that's your use case here. The problem appears to be where you are trying to add the template. I think you'll want to add the following to page.php
as that is the default template for pages. I find that the Query Monitor plugin has a useful feature of displaying which template is being used.
// add to page.php where you want your forms.
if ( is_page( 'faq' ) || is_page( 'FAQ' ) ) {
get_template_part( 'Servicedeneme' );
}
本文标签: functionsIsPage doesnt detect my page
版权声明:本文标题:functions - Is_Page doesnt detect my page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744506502a2609621.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
page-faq.php
. – Jacob Peattie Commented May 4, 2020 at 3:25