{"action":"created","issue":{"url":"https://api.github.com/repos/tlovett1/custom-contact-forms/issues/166","labels_url":"https://api.github.com/repos/tlovett1/custom-contact-forms/issues/166/labels{/name}","comments_url":"https://api.github.com/repos/tlovett1/custom-contact-forms/issues/166/comments","events_url":"https://api.github.com/repos/tlovett1/custom-contact-forms/issues/166/events","html_url":"https://github.com/tlovett1/custom-contact-forms/issues/166","id":106218900,"number":166,"title":"Loading javascript and stylesheet only when it is necessary","user":{"login":"webspilka","id":1138069,"avatar_url":"https://avatars.githubusercontent.com/u/1138069?v=3","gravatar_id":"","url":"https://api.github.com/users/webspilka","html_url":"https://github.com/webspilka","followers_url":"https://api.github.com/users/webspilka/followers","following_url":"https://api.github.com/users/webspilka/following{/other_user}","gists_url":"https://api.github.com/users/webspilka/gists{/gist_id}","starred_url":"https://api.github.com/users/webspilka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webspilka/subscriptions","organizations_url":"https://api.github.com/users/webspilka/orgs","repos_url":"https://api.github.com/users/webspilka/repos","events_url":"https://api.github.com/users/webspilka/events{/privacy}","received_events_url":"https://api.github.com/users/webspilka/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/tlovett1/custom-contact-forms/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-13T14:05:19Z","updated_at":"2015-10-09T01:42:55Z","closed_at":null,"body":"hi\r\nDo you have something similar to http://contactform7.com/loading-javascript-and-stylesheet-only-when-it-is-necessary/ ?\r\nI can not load scripts on pages where there is no form?"},"comment":{"url":"https://api.github.com/repos/tlovett1/custom-contact-forms/issues/comments/146733835","html_url":"https://github.com/tlovett1/custom-contact-forms/issues/166#issuecomment-146733835","issue_url":"https://api.github.com/repos/tlovett1/custom-contact-forms/issues/166","id":146733835,"user":{"login":"webstractions","id":3614852,"avatar_url":"https://avatars.githubusercontent.com/u/3614852?v=3","gravatar_id":"","url":"https://api.github.com/users/webstractions","html_url":"https://github.com/webstractions","followers_url":"https://api.github.com/users/webstractions/followers","following_url":"https://api.github.com/users/webstractions/following{/other_user}","gists_url":"https://api.github.com/users/webstractions/gists{/gist_id}","starred_url":"https://api.github.com/users/webstractions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webstractions/subscriptions","organizations_url":"https://api.github.com/users/webstractions/orgs","repos_url":"https://api.github.com/users/webstractions/repos","events_url":"https://api.github.com/users/webstractions/events{/privacy}","received_events_url":"https://api.github.com/users/webstractions/received_events","type":"User","site_admin":false},"created_at":"2015-10-09T01:42:55Z","updated_at":"2015-10-09T01:42:55Z","body":"I only use the CCF on one page in most cases. In my enqueue-functions.php file for the theme, I basically check to see if that page is the current one.  If not, I will dequeue all scripts/css for CCF. \r\n\r\nFor ContactForm 7, similar, but I add the filters to return '__return_false' like in the link above. \r\n\r\nThis technique works for virtually all plugins in the wild. My dequeue/enqueue processing can  get quite a bit involved, but worth the effort in the long run. For instance, I have a special slideshow script that runs on Project pages for the gallery section and it only gets enqueued if the post type is a project. \r\n\r\n"}}