• Resolved anoctave

    (@anoctave)


    Hi Anthony,

    How can I eliminate the banner space on pages other than the Front Page. I’ve been looking at some of the page templates and they call for the header. Could I take the banner code out of header.php and put it in the front page php?

    Also, on the Main Navigation. On your Quark demo the minimized screen has the menu as it is on my developing site, but the menu on your Quark home page appears horizontally even when minimized. Also in the Main menu as presented in the theme, the background is white while in your home page the background is the same as on the full size screen.

    I would like to have my menu background appear in the minimized version and I’d like the links to be horizontal.
    my site

    Hope you can help me with these. Thanks in advance

Viewing 10 replies - 1 through 10 (of 10 total)
  • Theme Author Anthony Hortin

    (@ahortin)

    To remove the banner on the internal pages and keep it on the homepage, change the is_front_page() check so that it’s above the line <div id="bannercontainer">. This way the banner containers wont be added unless the homepage is displaying. Also make sure you change the corresponding closing php tag as well, to the appropriate position.

    You’ve included the javascript that turns the menu into a button, when the site is seen on small devices, so you probably want to change that. Also, if you want the menu items to stay horizontal (rather than each on a separate line), then you need to adjust the media queries at the bottom of the stylesheet.

    In particular, remove the width and adjust the margins from these two styles. If you don’t want the background colour to be white, then you can remove that as well.

    .main-small-navigation,
    .main-navigation li {
       width: 100%;
    }
    
    .main-small-navigation ul li,
    .main-navigation ul li {
       background-color: #fff;
       margin: 5px 0;
       text-align: center;
    }
    Thread Starter anoctave

    (@anoctave)

    Dear Anthony,

    Thank you once again for your clear and helpful response. I have learned so much from your answers that I even understand how some of my changes interfered with the structure of your design. I don’t know if you understand what a quantum leap that is. I’m even beginning to understand the php code.

    I going on vacation with a good book (5-star comprehensive reviews on Amazon) on html5 and css3. I’m goona get this down yet.

    Thanks again.

    Thread Starter anoctave

    (@anoctave)

    Well, I spoke too soon about reading php code.

    I guess what’s not clear to me is how much of the code including “is_front_page” goes before the banner container div and what goes after the end div.

    I tried doing this twice. The first time I put the following code before the bannercontainer div:
    <?php if ( is_front_page() )
    The second time I added the “{“. Both returned an error message

    Parse error: syntax error, unexpected ‘<‘ in /hermes/bosweb26c/b2951/ipw.djgroupo/public_html/private/wordpress/wordpress1/wp-content/themes/water-works-conservancy/header.php on line 81

    Although this wasn’t included in the error message, I put the following the bannercontainer end div
    ?>
    the first time, and
    } ?>
    the second time. I moved them from just before the banner.row end div to just after bannercontainer end div.

    I went for the last code in the section because it seemed to me that the work of sorting out both the number of banners and their contents had to be worked out between the start div/end div of the bannercontainer.

    I guess I need to know specifically the code to move.

    On the menu, I’m sticking with the button. The instructions you gave me didn’t work so I went to look at the style.css for quarktheme.com (as opposed to the demo style.css) and your code there is different. So I decided not to fiddle around with that and leave it with the button

    I hope you can help me out with the banner code. I hope my explanation of what I did was clear.

    Theme Author Anthony Hortin

    (@ahortin)

    <?php if ( is_front_page() ) { ?>
    	<div id="bannercontainer">
    		<div class="banner row clearfix">
    			<?php
    				// Count how many banner sidebars are active so we can work out how many containers we need
    				$bannerSidebars = 0;
    				for ( $x=1; $x<=2; $x++ ) {
    					if ( is_active_sidebar( 'frontpage-banner' . $x ) ) {
    						$bannerSidebars++;
    					}
    				}
    
    				// If there's one or more one active sidebars, create a row and add them
    				if ( $bannerSidebars > 0 ) { ?>
    					<?php
    					// Work out the container class name based on the number of active banner sidebars
    					$containerClass = "grid_" . 12 / $bannerSidebars . "_of_12";
    
    					// Display the active banner sidebars
    					for ( $x=1; $x<=2; $x++ ) {
    						if ( is_active_sidebar( 'frontpage-banner'. $x ) ) { ?>
    							<div class="col <?php echo $containerClass?>">
    								<div class="widget-area" role="complementary">
    									<?php dynamic_sidebar( 'frontpage-banner'. $x ); ?>
    								</div> <!-- /.widget-area -->
    							</div> <!-- /.col.<?php echo $containerClass?> -->
    						<?php }
    					} ?>
    
    				<?php }
    			} ?>
    		</div> <!-- /.banner.row -->
    	</div> <!-- /#bannercontainer -->
    	} ?>
    Thread Starter anoctave

    (@anoctave)

    It worked. Thank you Anthony.

    Just for others who might want to use this code change, the last line
    } ?>
    results in those characters being printed on screen. Anyone wishing to have the banner only on the first page should copy from the top down to
    </div> <!-- /#bannercontainer -->
    and use it to replace the code currently in the header.php.

    Thanks again.

    Theme Author Anthony Hortin

    (@ahortin)

    Ahhh sorry. Just realised that last line should’ve said

    <?php } ?>

    You should make sure to include this modified php command otherwise you could have unwanted side effects.

    Thread Starter anoctave

    (@anoctave)

    Got the following error message.

    Parse error: syntax error, unexpected ‘}’ in /hermes/bosweb26c/b2951/ipw.djgroupo/public_html/private/wordpress/wordpress1/wp-content/themes/water-works-conservancy/header.php on line 114

    <?php } ?>

    Take ut the “}”?

    Thread Starter anoctave

    (@anoctave)

    Here’s the problem – extra “}” after 2nd php

    </div> <!-- /.col.<?php echo $containerClass?> -->
    						<?php }
    					} ?>
    
    				<?php }
    			} ?>
    Theme Author Anthony Hortin

    (@ahortin)

    Ok. Third time lucky. I’ve just tested and this works fine…

    <?php if ( is_front_page() ) { ?>
    	<div id="bannercontainer">
    		<div class="banner row clearfix">
    				<?php
    				// Count how many banner sidebars are active so we can work out how many containers we need
    				$bannerSidebars = 0;
    				for ( $x=1; $x<=2; $x++ ) {
    					if ( is_active_sidebar( 'frontpage-banner' . $x ) ) {
    						$bannerSidebars++;
    					}
    				}
    
    				// If there's one or more one active sidebars, create a row and add them
    				if ( $bannerSidebars > 0 ) {
    					// Work out the container class name based on the number of active banner sidebars
    					$containerClass = "grid_" . 12 / $bannerSidebars . "_of_12";
    
    					// Display the active banner sidebars
    					for ( $x=1; $x<=2; $x++ ) {
    						if ( is_active_sidebar( 'frontpage-banner'. $x ) ) { ?>
    							<div class="col <?php echo $containerClass?>">
    								<div class="widget-area" role="complementary">
    									<?php dynamic_sidebar( 'frontpage-banner'. $x ); ?>
    								</div> <!-- /.widget-area -->
    							</div> <!-- /.col.<?php echo $containerClass ?> -->
    						<?php }
    					}
    				} ?>
    		</div> <!-- /.banner.row -->
    	</div> <!-- /#bannercontainer -->
    	<?php } ?>
    Thread Starter anoctave

    (@anoctave)

    Thank you Anthony! All installed and working. You are the best.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Banner question and Menu question’ is closed to new replies.