Jump to content

bgbs

Members
  • Posts

    114
  • Joined

  • Last visited

Everything posted by bgbs

  1. I have this javascript code that loads in the footer. I only need this javascript to load on a static home page, not on all other pages. <script type="text/javascript"> var banner = (function(){ $('.banner').unslider({ speed: 1000, // The speed to animate each slide (in milliseconds) delay: 999000, // The delay between slide animations (in milliseconds) complete: function() {}, // A function that gets called after every slide animation keys: false, // Enable keyboard (left, right) arrow shortcuts dots: false, // Display dot navigation fluid: true // Support responsive design. May break non-responsive designs }); $( '#nav li:has(ul)' ).doubleTapToGo(); }); </script> <script> jQuery(document).ready(function() { jQuery('.nav-toggle').click(function(){ //get collapse content selector var collapse_content_selector = jQuery(this).attr('href'); //make the collapse content to be shown or hide var toggle_switch = jQuery(this); jQuery(collapse_content_selector).toggle(function(){ if(jQuery(this).css('display')=='none'){ toggle_switch.html('View All Services');//change the button label to be 'Show' }else{ toggle_switch.html('Hide Services List');//change the button label to be 'Hide' } }); }); }); </script> <script> jQuery(document).ready(function() { jQuery('.navtop-toggle').click(function(){ //get collapse content selector var collapse_content_selector = jQuery(this).attr('href'); //make the collapse content to be shown or hide var toggle_switch = jQuery(this); jQuery(collapse_content_selector).toggle(function(){ if(jQuery(this).css('display')=='none'){ toggle_switch.html('Menu');//change the button label to be 'Show' }else{ toggle_switch.html('Hide Menu');//change the button label to be 'Hide' } }); }); }); </script> So far I have this php statement, but I'm having trouble wrapping it in this php code. <?php if ($page=="home") echo " "; ?> I'm not sure if putting the whole javascript code above is a good idea in the echo quotes. Is there an easier or better way of wrapping javascript in PHP? Your help appreciated.
  2. Ok, so Im using if else in WP <?php if ( is_home() ) { // This is a homepage } else { <!-- header image --> <div class="dynamic-header"><?php if(function_exists('show_media_header')){ show_media_header(); } ?></div> <!-- /header image --> } ?> What I'm trying to do is load dynamic header banner on other pages except for home page. But I know I can't call php within php, so how do I properly wrap the code after else statement? Thanks in advance
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.