How can I add Javascript in the header of all post pages and only post pages

Check the type of the queried object on the page and the post type: function function_that_returns_js_string() { $obj = get_queried_object(); $type = is_a($obj,’WP_Post’); if (true === $type && ‘post’ == $obj->post_type) { echo ‘your string’; } } add_action(‘wp_head’, ‘function_that_returns_js_string’); However, I am concerned that you are inserting a script directly into the head of the … Read more

Easy popups for wordpress?

WordPress bundles a ThickBox library, which can be queued from its core. However it doesn’t quite bother to make external reuse easy (not that it’s overly complicated though). Notably ThickBox is very old. Depending on your specific requirements it might be preferable to choose a newer library and ship it with your own code (license … Read more