if is specific custom post in cpt

I don’t think that is possible using some function (I can be completely wrong though). What you can do is check page slug using if() statement. Something like: global $post; $post_slug=$post->post_name; if($post_slug==’harry-potter’){ //something here }

Custom post type is_singular condtional not working when managing sidebar display

I refactored the if conditional using suggestions from Jacob Peattie and the following fixed my issues. if ( ! is_page_template( array( ‘template-investment.php’, ‘template-tourism.php’ ) ) && ! is_tax( ‘listings’ ) && ! is_singular( ‘listing’ ) ) { The result correctly removed the sidebar.php from loading its code on specific templates, taxonomy, and single post type.

PHP Notice: Function is_page was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false

Your code looked good to me, so I believed that the PHP notice was unlikely caused by the code in question. But that issue could probably be caused by a previous version of that code. E.g. If you had used the init and not wp_enqueue_scripts hook to enqueue your script, then such notice is expected, … Read more

Including 2 Negative Is_Template Conditionals in header.php [closed]

(Expanding on Pieter’s comment above, and explaining the logic behind it…) if() evaluates the conditions in the parentheses, and that evaluation results in either TRUE or FALSE for the sum total (which can change, depending on how the various conditions are combined). In plain English, if( !is_singular(‘device’) || !is_front_page() ) means, “If it’s either true … Read more

Quick Conditional Tag Question if elseif [closed]

This is not really a WordPress Question, as you made a basic PHP mistake, but I’ll help you anyway 😉 you forgot to close the conditional with an } before the elseif statements. This should work: <ul> <?php if (get_post_meta($post->ID, ‘hm_check_image1’, true)) { ?> <li> stufff stuff other meta info… </li> <?php } else if … Read more

techhipbettruvabetnorabahisbahis forumutaraftarium24edusedusedueduseduedusedueduedusedus