how to remove black space on my wordpress 2016 - css

I am having problems reducing and/or removing the black space at the bottom of my wordpress webpage. Using inspector the black space seems to go over 2 css divs.
I need to add code in the custom css area to solve this but I dont know what to add.
http://andrewt.com.au/wp1/
this is the footer.php code
<?php
/**
* The template for displaying the footer
*
* Contains the closing of the #content div and all content after
*
* #package WordPress
* #subpackage Twenty_Sixteen
* #since Twenty Sixteen 1.0
*/
?>
</div><!-- .site-content -->
<footer id="colophon" class="site-footer" role="contentinfo">
<?php if ( has_nav_menu( 'primary' ) ) : ?>
<nav class="main-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Footer Primary Menu', 'twentysixteen' ); ?>">
<?php
wp_nav_menu( array(
'theme_location' => 'primary',
'menu_class' => 'primary-menu',
) );
?>
</nav><!-- .main-navigation -->
<?php endif; ?>
<?php if ( has_nav_menu( 'social' ) ) : ?>
<nav class="social-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Footer Social Links Menu', 'twentysixteen' ); ?>">
<?php
wp_nav_menu( array(
'theme_location' => 'social',
'menu_class' => 'social-links-menu',
'depth' => 1,
'link_before' => '<span class="screen-reader-text">',
'link_after' => '</span>',
) );
?>
</nav><!-- .social-navigation -->
<?php endif; ?>
</footer><!-- .site-footer -->
</div><!-- .site-inner -->
</div><!-- .site -->
<?php wp_footer(); ?>
</body>
</html>

Add this code in your footer.php
<?php
/**
* The template for displaying the footer
*
* Contains the closing of the #content div and all content after
*
* #package WordPress
* #subpackage Twenty_Sixteen
* #since Twenty Sixteen 1.0
*/
?>
<style>
#media screen and (min-width: 61.5625em){
.content-area .site-main {
margin-bottom: 0px;
}
}
</style>
</div><!-- .site-content -->
<footer id="colophon" class="site-footer" role="contentinfo">
<?php if ( has_nav_menu( 'primary' ) ) : ?>
<nav class="main-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Footer Primary Menu', 'twentysixteen' ); ?>">
<?php
wp_nav_menu( array(
'theme_location' => 'primary',
'menu_class' => 'primary-menu',
) );
?>
</nav><!-- .main-navigation -->
<?php endif; ?>
<?php if ( has_nav_menu( 'social' ) ) : ?>
<nav class="social-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Footer Social Links Menu', 'twentysixteen' ); ?>">
<?php
wp_nav_menu( array(
'theme_location' => 'social',
'menu_class' => 'social-links-menu',
'depth' => 1,
'link_before' => '<span class="screen-reader-text">',
'link_after' => '</span>',
) );
?>
</nav><!-- .social-navigation -->
<?php endif; ?>
</footer><!-- .site-footer -->
</div><!-- .site-inner -->

Your website is broken, or have very-very-very bad coded.
Add this css rules to custom css area( as you mentioned ):
#main{
margin-bottom: 10px;
}
footer{
padding: 5px; //or you can decrease/increase it
}
If after adding and refreshing/deleting cache of page, it doesn't affected, than try to use:
#main{
margin-bottom: 10px !important;
}
footer{
padding: 5px !important; //or you can decrease/increase it
}
or try to write the rules provided to some other stylesheet, such as default customizer of wordpress: Customize => Additional Css.

Related

How to change Wordpress logo when scrolling (understrap-child theme)

I'm building a website using understrap-child theme.
What I would like to achieve is my navbar logo (added through Appearance -> Customize) to change into another one when scrolling the page.
In functions.php I've already added a section in order to be able to add a second logo, which I've successfully added in the Appearance -> Customize section.
Here's the code in functions.php:
//ADDING NEW LOGO FIELD
function your_theme_customizer_setting($wp_customize) {
// add a setting
$wp_customize->add_setting('your_theme_hover_logo');
// Add a control to upload the hover logo
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'your_theme_hover_logo', array(
'label' => 'Upload Hover Logo',
'section' => 'title_tagline', //this is the section where the custom-logo from WordPress is
'settings' => 'your_theme_hover_logo',
'priority' => 8 // show it just below the custom-logo
)));
}
add_action('customize_register', 'your_theme_customizer_setting');
get_theme_mod( 'your_theme_hover_logo' );
Now that I have two logos set, I would like to know how to replace the first logo with the second one when scrolling my page.
Here's my header.php section with the navbar:
<!-- ******************* The Navbar Area ******************* -->
<div id="wrapper-navbar">
<a class="skip-link sr-only sr-only-focusable" href="#content"><?php esc_html_e( 'Skip to content', 'understrap' ); ?></a>
<nav id="main-nav" class="navbar navbar-expand-md navbar-dark fixed-top" aria-labelledby="main-nav-label">
<h2 id="main-nav-label" class="sr-only">
<?php esc_html_e( 'Main Navigation', 'understrap' ); ?>
</h2>
<?php if ( 'container' === $container ) : ?>
<div class="container">
<?php endif; ?>
<!-- Your site title as branding in the menu -->
<?php if ( ! has_custom_logo() ) { ?>
<?php if ( is_front_page() && is_home() ) : ?>
<h1 class="navbar-brand mb-0"><a rel="home" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" itemprop="url"><?php bloginfo( 'name' ); ?></a></h1>
<?php else : ?>
<a class="navbar-brand" rel="home" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" itemprop="url"><?php bloginfo( 'name' ); ?></a>
<?php endif; ?>
<?php } else {
the_custom_logo();
} ?><!-- end custom logo -->
Please notice that I've already added a Query in order to change the navbar background color when scrolling...and that works!
</script>
<script>jQuery(window).scroll(function(){
jQuery('nav').toggleClass('scrolled', jQuery(this).scrollTop() > 80);
});</script>
with its CSS rules:
#media (min-width: 992px) {
.navbar.scrolled {
background-color: $secondary;
border-bottom: solid rgba(37, 36, 36, 0.055);
I really hope you can help me solve my problem!
THANK YOU SO MUCH!!

wordpress menu adding unpredictable items

Wordpress menu is adding several additiom and empty a tags (exacly two)
if (has_nav_menu('secondary')) :
?>
<nav id="menu-secondary-title" class="nav-anchors">
<div class="wrap">
<a id="menu-secondary-anchor" class="menu-secondary-anchor" title="<?php _e('Secondary Mobile Menu', 'path'); ?>" href="#menu-secondary-mobile"><?php //_e( 'Check Us Out!', 'path' ); ?></a>
<div id="mobile-menu-secondary">
<img src="<?php echo get_template_directory_uri(); ?>/images/Hamburger_icon.svg.png"
<?php wp_nav_menu(array('theme_location' => 'secondary', 'container_class' => 'menu-secondary-mobile-top', 'menu_class' => '', 'menu_id' => 'menu-secondary-items', 'fallback_cb' => '')); ?>
</div>
</div><!-- .wrap -->
</nav><!-- #menu-secondary-title -->
<nav id="menu-secondary" class="menu-container">
<div class="wrap clr">
<?php wp_nav_menu(array('theme_location' => 'secondary', 'container_class' => 'menu', 'menu_class' => '', 'menu_id' => 'menu-secondary-items', 'fallback_cb' => '')); ?>
</div><!-- .wrap -->
</nav><!-- #menu-secondary .menu-container -->
<?php endif; ?>
Please, help me find where could be something wrong. Which which next wordpress file can I explore, to find where is problem?

Why wp_footer() is called in wp_footer() footer.php itself ?

I am trying to understand theme creating in WP. And according what I understand wp_footer() includes footer.php in the main page. But what I am don't understand is why wp_footer() is called in footer.php itself like in twentyseventeen footer ?
</div><!-- #content -->
<footer id="colophon" class="site-footer" role="contentinfo">
<div class="wrap">
<?php
get_template_part( 'template-parts/footer/footer', 'widgets' );
if ( has_nav_menu( 'social' ) ) : ?>
<nav class="social-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Footer Social Links Menu', 'twentyseventeen' ); ?>">
<?php
wp_nav_menu( array(
'theme_location' => 'social',
'menu_class' => 'social-links-menu',
'depth' => 1,
'link_before' => '<span class="screen-reader-text">',
'link_after' => '</span>' . twentyseventeen_get_svg( array( 'icon' => 'chain' ) ),
) );
?>
</nav><!-- .social-navigation -->
<?php endif;
get_template_part( 'template-parts/footer/site', 'info' );
?>
</div><!-- .wrap -->
</footer><!-- #colophon -->
</div><!-- .site-content-contain -->
</div><!-- #page -->
<?php wp_footer(); Here?>
wp_footer() in wordpress in not used for including the footer, in fact get_footer() does that.
The wp_footer() is used for outputting data or doing background actions that run just before closing body tag.
Hope that makes it clear!!
As per my knowledge the wp_footer() in footer.php is used for printing scripts or data before the closing body tag on the front end.
Reference Link: http://www.twoclock.com/wp_footer-wordpress-action-hook/

Pagination is not working in archive page in WordPress

Every pagination link take me to the first page every time. I have tried with or without a plugin, but nothing works. It doesn't matter if I click on the Next button or the Prev button. It always takes me to the first page.
<?php
/*
Template Name: Notices & Circulars
*/
get_header(); ?>
<div class="banner-box">
<div class="wrap">
<div class="main-top">
<div class="main">
<h1><div class="titlepage"><?php the_title();?></div></h1>
<section class="content">
<?php
$args=array(
'cat'=> 14,
'posts_per_page' => 10,
'offset' => 5,
'paged' => get_query_var('page')
);
if ( have_posts() ) :
query_posts($args);
?>
<?php while(have_posts()):the_post();?>
<li style="list-style:none;">
<h3><font style="color:#666666;"><?php the_title(); ?></h3>
<?php
/***** Thumbnail ******/
the_post_thumbnail(
array(120, 90),
array(
'class' => 'thumbnail',
'alt' => 'post thumbnail',
'title' => 'my custom title'
)
);
/******* Thumbnail Ends ********/
the_content(__('Continue Reading'));?></font>
</li><hr /><?php
endwhile;
wp_pagenavi();
endif;
?>
</div>
</div>
</div>
<?php get_footer(); ?>
</div>
Please try this:
<?php
/*
Template Name: Notices & Circulars
*/
get_header(); ?>
<div class="banner-box">
<div class="wrap"><div class="main-top"><div class="main">
<h1><div class="titlepage"><?php the_title();?></div></h1>
<section class="content">
<?php
// Example for adding WP PageNavi to a new WP_Query call
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$args = array('post_type' => 'post','cat'=> 14,'posts_per_page' => 10, 'paged' => $paged);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
?>
<li style="list-style:none;">
<h3><font style="color:#666666;"><?php the_title(); ?></h3>
<?php
/***** Thumbnail ******/
the_post_thumbnail(
array(120, 90),
array(
'class' => 'thumbnail',
'alt' => 'post thumbnail',
'title' => 'my custom title'
)
);
/******* Thumbnail Ends ********/
the_content(__('Continue Reading'));?></font>
</li><hr />
<?php
endwhile; ?>
<?php wp_pagenavi( array( 'query' => $loop ) ); ?>
</div></div></div>
<?php get_footer();?></div>

Show WordPress Primary Menu in Zurb Foundation header [_s theme ]

I am creating a theme based on _s & Zurb's Foundation.
I have pretty much got everything set up and ready to start into the CSS, but I am having issues getting the 'primary menu' to show on the top bar.
I want to leave the 'left nav button' where it is, for a highlighted link (possibly contact us or similar), but I want to replace the current content in ul class="right" for the WordPress Primary Menu.
Here is what I have in the current header id="masthead"
<header id="masthead" class="site-header" role="banner">
<div class="row">
<div class="site-branding">
<h1 class="site-title">
<?php bloginfo( 'name' ); ?></h1>
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
</div>
<div class="contain-to-grid sticky">
<nav id="site-navigation" class="top-bar" data-topbar data-options="sticky_on: large" role="navigation">
<ul class="title-area">
<li class="name">
<h4><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
<?php bloginfo( 'name' ); ?></a></h4>
</li>
<li class="toggle-topbar menu-icon">Menu</li>
</ul>
<section class="top-bar-section">
<!-- Right Nav Section -->
<ul class="right">
<li class="active">Right Button Active</li>
<li class="has-dropdown">
Right Button Dropdown
<ul class="dropdown">
<li>First link in dropdown</li>
</ul>
</li>
</ul>
<!-- Left Nav Section -->
<ul class="left">
<li>Left Nav Button</li>
</ul>
</section>
</nav><!-- #site-navigation -->
</div>
</div> <!-- row -->
</header><!-- #masthead -->
You need to use wp_nav_menu().
http://codex.wordpress.org/Function_Reference/wp_nav_menu
You will also need to use a walker which customises the output of wp_nav_menu() to match that of Foundation's top bar.
You can add this to your funtions.php
class guts_top_bar_walker extends Walker_Nav_Menu {
function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) {
$element->has_children = !empty($children_elements[$element->ID]);
$element->classes[] = ( $element->current || $element->current_item_ancestor ) ? 'active' : '';
$element->classes[] = ( $element->has_children ) ? 'has-dropdown' : '';
parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
}
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$item_html = '';
parent::start_el( $item_html, $item, $depth, $args, $id );
$output .= ($depth == 0) ? '<li class="divider"></li>' : '';
$classes = empty($item->classes) ? array() : (array) $item->classes;
if ( in_array( 'section', $classes ) ) {
$output .= '<li class="divider"></li>';
$item_html = preg_replace('/<a[^>]*>(.*)<\/a>/iU', '<label>$1</label>', $item_html);
}
$output .= $item_html;
}
function start_lvl( &$output, $depth = 0, $args = array() ) {
$output .= "\n<ul class=\"sub-menu dropdown\">\n";
}
}
You specify the walker within wp_nav_menu(). Replace the section area of the top bar in your header with the following;
<section class="top-bar-section">
<?php wp_nav_menu(array('container' => false, 'menu_class' => 'left', 'theme_location' => 'primary-left', 'fallback_cb' => false, 'walker' => new guts_top_bar_walker() )); ?>
<?php wp_nav_menu(array('container' => false, 'menu_class' => 'right', 'theme_location' => 'primary', 'walker' => new guts_top_bar_walker() )); ?>
</section>
Even if you want a highlighted link to remain in the left section, I'd recommend setting up another menu so that you can make future changes directly through the wordpress dash, instead of requiring edits to your theme.
You can register a new menu area like this in functions.php:
register_nav_menu( 'primary-left', __( 'Left Navigation Menu', 'guts' ) );
more info here: http://codex.wordpress.org/Function_Reference/register_nav_menus

Resources