How to load plugin function only on one page.
-
Hey guys. I use welcome plugin to load intro welcome text on my site. Problem is that this plugin is loading everywhere on all pages, and I want to load it only on Specific pages. Can I setup it only to load on specific pages? This is code lines which are controlling this option I think. Will be happy for every answer.
function welcome_output (){ if(is_home()) global $wDefaults; $wVar = welcome_getOptions(); if($_COOKIE[$wDefaults['welcome_cookie_name']] == '1') return; echo '<div id="cover" style="background-color: ' .$wVar['welcome_color']. ';height:100%;width:100%; position:fixed;z-index:2147483646; top: 0; margin: 0 auto; left:0;">' . $wVar['welcome_content'] . '</div><noscript><style>#cover{ display: none; visibility: hidden; height: 0px; width: 0px; }</style></noscript>'; /* JS generation, mess */ echo '<script> jQuery(document).ready(function($){'; if($wVar['welcome_cookie_duration'] > 0) echo 'if(jQuery.cookie("'.$wDefaults['welcome_cookie_name'].'")=="1") return;'; echo 'setTimeout(function() { jQuery("#cover").fadeOut('. ($wVar['welcome_sec_fade_out'] * 1000) .'); }, '. ($wVar['welcome_sec_after'] * 1000) .'); jQuery.cookie("'.$wDefaults['welcome_cookie_name'] .'", "1", { expires: '. $wVar['welcome_cookie_duration'] .' }); }); </script>'; wp_enqueue_script('jquery'); wp_enqueue_script( 'jquery-cookie', plugins_url('/jquery.cookie.js', __FILE__ ), array( 'jquery' ), '1.4.1', false ); }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to load plugin function only on one page.’ is closed to new replies.