My site uses JetPack to include infinite scroll on archive pages and to create a portfolio CPT.
This is causing problems on the portfolio archive page, so I want to turn off infinite scroll on this page
Here is what I am trying (including an alert to show which page type is loaded):
// Add theme support for Infinite Scroll.
if ( 'post_type' != 'portfolio' ) :
echo '<script language="javascript">';
echo 'alert("Not a Portfolio page")';
echo '</script>';
add_theme_support( 'infinite-scroll', array(
'container' => 'main',
'footer' => 'false', // edited was page
'render' => 'thisSite_infinite_scroll_render',
) );
else :
echo '<script language="javascript">';
echo 'alert("is a Portfolio page")';
echo '</script>';
add_theme_support( 'infinite-scroll', array(
'container' => 'main',
'footer' => 'false', // edited was page
'render' => 'false',
) );
endif;
Trouble is that 'post_type' != 'portfolio' is not working, nor does 'post_type' != 'jetpack-portfolio'
How do I test for this condition?
if ( 'post_type' != 'portfolio' )
is a condition were a fixed string literal is compared with another different string literal, meaning this will always evalutate to true? This makes the if-branch kind of useless. – Striezel