WordPress.org

Ready to get started?Download WordPress

Forums

Quark
[resolved] Banner question and Menu question (11 posts)

  1. anoctave
    Member
    Posted 1 year ago #

    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

  2. ahortin
    Member
    Theme Author

    Posted 1 year ago #

    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;
    }
  3. anoctave
    Member
    Posted 1 year ago #

    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.

  4. anoctave
    Member
    Posted 1 year ago #

    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.

  5. ahortin
    Member
    Theme Author

    Posted 1 year ago #

    <?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 -->
    	} ?>
  6. anoctave
    Member
    Posted 1 year ago #

    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.

  7. ahortin
    Member
    Theme Author

    Posted 1 year ago #

    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.

  8. anoctave
    Member
    Posted 1 year ago #

    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 "}"?

  9. anoctave
    Member
    Posted 1 year ago #

    Here's the problem - extra "}" after 2nd php

    </div> <!-- /.col.<?php echo $containerClass?> -->
    						<?php }
    					} ?>
    
    				<?php }
    			} ?>
  10. ahortin
    Member
    Theme Author

    Posted 1 year ago #

    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 } ?>
  11. anoctave
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic