uggur
asked 6 years ago

I have a function in my functions.php to insert custom banner code for all post but I dont want to show it on QA pages. So I need to get if case for is it DWQA or regular wp post. How can I handle this?
My current function is like:
 if ( is_single() && ! is_admin() ) {
..
}
So I need to put additional code to detect is it dwqa or not. Could you help me please?

1 Answers
DominicStaff
answered 6 years ago

You can use the following code: 

if ( is_singular( 'dwqa-question' ) || is_singular( 'dwqa-answer' ) ) { 
    ..... 
    ...... 
    .........
}

or: 

if ( is_singular( 'dwqa-question' ) || is_singular( 'dwqa-answer' ) || ( $dwqa_options['pages']['archive-question'] && is_page( $dwqa_options['pages']['archive-question'] ) ) || ( $dwqa_options['pages']['submit-question'] && is_page( $dwqa_options['pages']['submit-question'] ) ) ) { 
    .....
    ...... 
    .........
}

 

Powered by DW Question & Answer Pro