Is there a conditional tag to determine whether the post is _any_ custom post type?

I don’t know of a conditional tag, but here’s how you would list the built-in types: echo implode(‘,’, get_post_types( array(‘_builtin’ => true ) ) ); Output: post,page,attachment,revision,nav_menu_item Maybe better: // 1 result if it exists and is builtin, 0 otherwise get_post_types( array(‘_builtin’ => true, ‘name’ => $post_type ) );

Trouble with parent and child conditional tag to show content

If it is about child post types* or taxonomies**: // page/post/cpt parent check: $post_object = get_queried_object(); // check if the page has a parent if ( $post_object->post_parent ) // do stuff // cat/tax parent check: $taxonomy_object = get_the_category( get_query_var(‘cat’) ); // check if the cat/tag/tax has a parent: if ( $taxonomy_object->parent ) // do stuff … Read more

Register widget only page is a singular of custom post type

Instead of nuking the entire widget, you should put your conditional statements within the widget itself: public function widget( $args, $instance ) { if ( is_singular( array( ‘post_type_a’, ‘post_type_b’ ) ) ) { // display your widget here } } Since you’re not printing $before_widget and $after_widget, there won’t be any output for this widget … Read more

is_page conditional question

If the page slug is ‘contact’ then is_page(‘contact’) should work. You can check out the optional parameters for page in the codex here . Using post ID, e.g. 94 in your example will work regardless of permalink settings. If you want it to display for a specific template you can use is_page_template(‘contact.php’).

Only show content if current page is NOT one of 2 page templates [closed]

If you want don’t want to show content if the current template is template-custom.php or template-custom2.php you can use: if (!is_page_template(‘template-custom.php’) && !is_page_template(‘template-custom2.php’)) { <!– show some content when you AREN NOT in template-custom.php NOR template-custom2.php –> } or if (is_page_template(‘template-custom.php’) || is_page_template(‘template-custom2.php’)) { <!– show some content when you ARE in template-custom.php OR template-custom2.php … Read more

Remove CSS & JS files from WordPress Main Page For Increase Pagespeed?

Does it work any better added to a hook with the conditionals inside? function my_deregisters() { if ( !is_single() ) { remove_action(‘wp_head’, ‘wp_page_numbers_stylesheet’); //wp_deregister_style( ‘fancybox’ ); // i think this can be removed //wp_deregister_script( ‘fancybox’ ); // i think this can be removed wp_dequeue_script(‘fancybox’); wp_dequeue_style(‘fancybox’); remove_action(‘wp_print_scripts’, ‘mfbfw_load’); remove_action(‘wp_print_styles’, ‘mfbfw_css’); remove_action(‘wp_head’, ‘mfbfw_init’); remove_action(‘wp_head’, ‘cforms_style’); } } … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)