Reputation: 1
Im working on a wordpress 4 bootstrap theme and Im trying to figure out the footer alignment for the social icons (font awesome) in my custom wordpress theme footer.php file.
In bootstrap test page the footer works with padding above and below the rows with the social icons.
Its using this class: "footer class="section section-primary"
Here is the full page working in bootstrap:
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script type="text/javascript" src="http://netdna.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<link href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css"
rel="stylesheet" type="text/css">
<link href="http://pingendo.github.io/pingendo-bootstrap/themes/default/bootstrap.css"
rel="stylesheet" type="text/css">
</head>
<body>
<div class="cover">
<div class="navbar">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-ex-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"><span>Brand</span></a>
</div>
<div class="collapse navbar-collapse" id="navbar-ex-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active">
<a href="#">Home</a>
</li>
<li>
<a href="#">Contacts</a>
</li>
</ul>
</div>
</div>
</div>
<div class="cover-image" style="background-image: url(https://unsplash.imgix.net/photo-1418065460487-3e41a6c84dc5?q=25&fm=jpg&s=127f3a3ccf4356b7f79594e05f6c840e);"></div>
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<h1 class="text-inverse">Heading</h1>
<p class="text-inverse">Lorem ipsum dolor sit amet, consectetur adipisici eli.</p>
<br>
<br>
<a class="btn btn-lg btn-primary">Click me</a>
</div>
</div>
</div>
</div>
<div class="section">
<div class="container">
<div class="row">
<div class="col-md-6">
<img src="http://pingendo.github.io/pingendo-bootstrap/assets/placeholder.png"
class="img-responsive">
</div>
<div class="col-md-6">
<h1 class="text-primary">A title</h1>
<h3>A subtitle</h3>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo
ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis
dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies
nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.
Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In
enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum
felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus
elementum semper nisi.</p>
</div>
</div>
</div>
</div>
<div class="section">
<div class="container">
<div class="row">
<div class="col-md-6">
<h1 class="text-primary">A title</h1>
<h3>A subtitle</h3>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo
ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis
dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies
nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.
Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In
enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum
felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus
elementum semper nisi.</p>
</div>
<div class="col-md-6">
<img src="http://pingendo.github.io/pingendo-bootstrap/assets/placeholder.png"
class="img-responsive">
</div>
</div>
</div>
</div>
<div class="section">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1 class="text-center text-primary">Team</h1>
<p class="text-center">We are a group of skilled individuals.</p>
</div>
</div>
<div class="row">
<div class="col-md-4">
<img src="http://pingendo.github.io/pingendo-bootstrap/assets/user_placeholder.png"
class="center-block img-circle img-responsive">
<h3 class="text-center">John Doe</h3>
<p class="text-center">Developer</p>
</div>
<div class="col-md-4">
<img src="http://pingendo.github.io/pingendo-bootstrap/assets/user_placeholder.png"
class="center-block img-circle img-responsive">
<h3 class="text-center">John Doe</h3>
<p class="text-center">Developer</p>
</div>
<div class="col-md-4">
<img src="http://pingendo.github.io/pingendo-bootstrap/assets/user_placeholder.png"
class="center-block img-circle img-responsive">
<h3 class="text-center">John Doe</h3>
<p class="text-center">Developer</p>
</div>
</div>
</div>
</div>
<footer class="section section-primary">
<div class="container">
<div class="row">
<div class="col-sm-6">
<h1>Footer header</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisici elit,
<br>sed eiusmod tempor incidunt ut labore et dolore magna aliqua.
<br>Ut enim ad minim veniam, quis nostrud</p>
</div>
<div class="col-sm-6">
<p class="text-info text-right">
<br>
<br>
</p>
<div class="row">
<div class="col-md-12 hidden-lg hidden-md hidden-sm text-left">
<a href="#"><i class="fa fa-3x fa-fw fa-instagram text-inverse"></i></a>
<a href="#"><i class="fa fa-3x fa-fw fa-twitter text-inverse"></i></a>
<a href="#"><i class="fa fa-3x fa-fw fa-facebook text-inverse"></i></a>
<a href="#"><i class="fa fa-3x fa-fw fa-github text-inverse"></i></a>
</div>
</div>
<div class="row">
<div class="col-md-12 hidden-xs text-right">
<a href="#"><i class="fa fa-3x fa-fw fa-instagram text-inverse"></i></a>
<a href="#"><i class="fa fa-3x fa-fw fa-twitter text-inverse"></i></a>
<a href="#"><i class="fa fa-3x fa-fw fa-facebook text-inverse"></i></a>
<a href="#"><i class="fa fa-3x fa-fw fa-github text-inverse"></i></a>
</div>
</div>
</div>
</div>
</div>
</footer>
</body>
</html>
In my wordpress theme (footer.php) I had issues with the footer not sticking to the bottom of the page when using the bootstrap footer class ("footer class="section section-primary") it did align properly like in the above bootstrap code.
To get the sticky footer to work in my wordpress theme, I had to use the class "footer" and I did the following with css & js to get my footer to stick to the bottom:
var bumpIt = function() {
$('body').css('margin-bottom', $('.footer').height());
},
didResize = false;
bumpIt();
$(window).resize(function() {
didResize = true;
});
setInterval(function() {
if(didResize) {
didResize = false;
bumpIt();
}
}, 100);
body {
/* Margin bottom by footer height */
margin-bottom: 140px;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
color: white;
/* Set the fixed height of the footer here */
/*height: 140px; */
background-color: #313131;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet"/>
<!-- ========== FOOTER ========== -->
<footer class="footer">
<div class="section section-primary">
<div class="container">
<div class="row">
<div class="col-sm-6">
<h1>My Website</h1>
<p>© <?php bloginfo('name'); ?> <?php echo date('Y'); ?></p>
</div>
<div class="col-sm-6">
<p class="text-info text-right">
<br>
<br>
</p>
<div class="row">
<div class="col-md-12 hidden-lg hidden-md hidden-sm text-left">
<a href="#"><i class="fa fa-3x fa-fw fa-instagram text-inverse"></i></a>
<a href="#"><i class="fa fa-3x fa-fw fa-twitter text-inverse"></i></a>
<a href="#"><i class="fa fa-3x fa-fw fa-facebook text-inverse"></i></a>
<a href="#"><i class="fa fa-3x fa-fw fa-github text-inverse"></i></a>
</div>
</div>
<div class="row">
<div class="col-md-12 hidden-xs text-right">
<a href="#"><i class="fa fa-3x fa-fw fa-instagram text-inverse"></i></a>
<a href="#"><i class="fa fa-3x fa-fw fa-twitter text-inverse"></i></a>
<a href="#"><i class="fa fa-3x fa-fw fa-facebook text-inverse"></i></a>
<a href="#"><i class="fa fa-3x fa-fw fa-github text-inverse"></i></a>
</div>
</div>
</div>
</div>
</div>
</div>
</footer>
<?php wp_footer(); ?>
</body>
</html>
In footer.php The font awesome rows are right on the bottom. Id like them to have some padding below them like in the first bootstrap only example.
I tried changing the wordpress theme footer.php footer class from "footer" to "section section-primary" and that works but breaks my sticky footer.
Thanks for any help.
Upvotes: 0
Views: 607
Reputation: 3689
You can try putting the <footer></footer>
in the <body></body>
and calling margin:0;
on your body at the very top of your CSS file.
This removes all margin at first, but is overwritten when you add a margin to let's say your footer or any other element.
Hope this helps!
Upvotes: 0