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' );
}
page-faq.php
. – Jacob Peattie Commented May 4, 2020 at 3:25