• Resolved Tiredtraveller

    (@tiredtraveller)


    I’ve tried reading over other posts and don’t understand the way to change PHP code to make it work so the homepage banner is different. I have uploaded a new file in the same folder as the banner image is located and named it banner small.png

    I know there is a way to use PHP to make it use “banner” if it is the homepage and “banner small” if it is another page, but not sure how to implement this into the code. The site is a custom template. The header.php code where the banner img is taken from is below.

    <title><?php wp_title('',true,''); ?> - <?php bloginfo('name'); ?></title>
     <link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" type="text/css" />
      <?php wp_head(); ?>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
    <script>
    jQuery.fx.off = true;
    jQuery(document).ready(function(){
    
    	//jQuery("ul.sub-menu").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav
    
    	jQuery("ul.topnav li").hover(function() { //When trigger is clicked...
    		jQuery(this).addClass("subhover");
    		//Following events are applied to the subnav itself (moving subnav up and down)
    		jQuery(this).find("ul.children").slideDown(100).show(); //Drop down the subnav on click
    
    		/**jQuery(this).parent().hover(function() {
    		}, function(){
    			jQuery(this).find("ul.children").slideUp(100); //When the mouse hovers out of the subnav, move it back up
    		}); **/
    
    		//Following events are applied to the trigger (Hover events for the trigger)
    		//}).hover(function() {
    			//jQuery(this).addClass("subhover"); //On hover over, add class "subhover"
    		}, function(){	//On Hover Out
    			jQuery(this).removeClass("subhover"); //On hover out, remove class "subhover"
    			jQuery(this).find("ul.children").slideUp('slow');
    	});
    //right bar navigation
    	jQuery("ul.rightnava li").hover(function(){
    		jQuery('ul',this).first().show();
    	},function(){
    		jQuery('ul',this).first().hide();
    	});
    
    });
    </script>
    </head>
    <body>
    <div id="MainWrapper">
     <div id="header">
      <img src="<?php bloginfo('template_directory'); ?>/images/banner.png" alt="<?php bloginfo('name'); ?> - <?php bloginfo('description'); ?>" />
      <div id="logo"><a href="<?php bloginfo('url'); ?>" title="<?php bloginfo('description'); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/logo.png" alt="<?php bloginfo('description'); ?>" /></a></div>
     <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Header widgets') ) : ?>
    	<?php endif; ?>
     </div><!-- end #header -->
    <div id="head-nav">
    	<ul>
    <div class="menu-header_menu-container"> <ul id="menu-header_menu" class="topnav"> <?php
       wp_list_pages("title_li=&depth=2" );
        ?></ul></div>
    <div style="clear:both;"></div>
    	</ul>
    <div style="clear:both;"></div>
     </div><!-- end #head-nav -->
    <div style="clear:both;"></div>
Viewing 1 replies (of 1 total)
  • Thread Starter Tiredtraveller

    (@tiredtraveller)

    Just following up on this. There is also a home.php and a page template Php. One for the home page and the other is used for the rest of the site. Would this link into the solution in anyway?

Viewing 1 replies (of 1 total)
  • The topic ‘Using a banner on Homepage and a different one on all other pages, PHP question’ is closed to new replies.