{"id":11575,"date":"2021-04-25T11:17:47","date_gmt":"2021-04-25T11:17:47","guid":{"rendered":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/dplugins.com\/?post_type=code_snippets&#038;p=11575"},"modified":"2022-05-13T20:06:55","modified_gmt":"2022-05-13T20:06:55","slug":"scripts-on-excluded-page","status":"publish","type":"post","link":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/scripts-on-excluded-page\/","title":{"rendered":"Scripts on Excluded pages"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">At the moment we have option to select pages on which you want to apply scripts. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thats why I made a small code snippet to help you create this option as well.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Write Page, Post ID or Slug on witch pages you don&#8217;t want that script is applied and it will be applied on all the rest.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this example bellow I don&#8217;t want red background on  Page ID 5  ( homepage ) and &#8220;Page 3&#8221; as well.  <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php if (is_page( array( 5, 'page-3' ) ) ) : ?&gt;\n    &lt;!-- Do nothing --&gt;\n&lt;?php else : ?&gt;\n    &lt;!-- Insert your code here --&gt;\n\t&lt;style&gt;\n\t  body{\n\t\tbackground: red;\n\t  }\n\t&lt;\/style&gt;  \n&lt;?php endif; ?&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Trigger Location: Conditions<br>Script Location: PHP<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-content\/uploads\/2022\/05\/Screenshot-2021-04-25-at-13.11.05-1024x556.png\" alt=\"screenshot 2021 04 25 at 13.11.05\" class=\"wp-image-11578\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>At the moment we have option to select pages on which you want to apply scripts. Thats why I made a small code snippet to help you create this option as well. Write Page, Post ID or Slug on witch pages you don&#8217;t want that script is applied and it will be applied on all [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":44821,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"Scripts on Excluded pages - Code DPlugins","description":"At the moment we have option to select pages on which you want to apply scripts. Thats why I made a small code snippet to help you create this option as well. W"},"_slim_seo_primary_term_category":0,"_slim_seo_primary_term_post_tag":0,"footnotes":""},"categories":[3],"tags":[],"dpc_library":[],"class_list":["post-11575","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress"],"_links":{"self":[{"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/posts\/11575","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/comments?post=11575"}],"version-history":[{"count":0,"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/posts\/11575\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/media\/44821"}],"wp:attachment":[{"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/media?parent=11575"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/categories?post=11575"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/tags?post=11575"},{"taxonomy":"dpc_library","embeddable":true,"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/dpc_library?post=11575"}],"curies":[{"name":"wp","href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/api.w.org\/{rel}","templated":true}]}}