Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WP – How to add a script to a specific page Reply To: WP – How to add a script to a specific page

#182138
Senff
Participant

I just found out thatis_page_templateonly works if it’s an actual PAGE — it won’t work on POSTS.

Instead, the check should be done on something like this:

if( 'mycustomtypename' == $post_type ) {
    wp_enqueue_script( 'googleapi' );
    wp_enqueue_script( 'googlemaps' );
}

This guy is doing it (even with the if statement) and it works. Hmm.

I don’t think he actually said it works with that conditional statement…. I may be wrong. @taxicss can you elaborate please?