is_singular() not working
-
The problem is this simple: it doesn’t work. The code is:
/** custom post types */ function create_post_type() { //projects register_post_type( 'project', array( 'labels' => array( 'name' => __( 'Projects' ), 'singular_name' => __( 'Project' ) ), 'public' => true, 'hierarchical' => true, 'supports' => array('title','editor','thumbnail','custom-fields','page-attributes') ) ); } add_action( 'init', 'create_post_type' ); /** scripts */ function my_init_method() { if(is_singular('project')) { wp_deregister_script( 'jquery-topup' ); wp_register_script( 'jquery-topup', 'https://gettopup.com/releases/latest/top_up-min.js'); wp_enqueue_script( 'jquery-topup' ); } } add_action('init', 'my_init_method');
When I render a single post of type
project
, the script is not called, whereas if I set theif(true)
it does appear. Even theis_singular()
doesn’t render in single pages.Any known issue?
Thank you
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘is_singular() not working’ is closed to new replies.