I have been trying to add in a floating footer bar to my website. I have added the CSS to the CSS file and added the other code to my global footer. I see when I use “view page source” that it sees the code in my footer asking to load the DIV:floating footer" but nothing loads.
I know nothing of Wordpress but you have a rule here that sets the #tips li to display:none.
#tips li {
padding: 15px 0;
display: none;
}
That means you won’t see it.
If you remove the display:none then the footer should show but I believe the demo you linked to mentions this and that you should be showing a random tip with some jquery script which I don’t see in your page.
<script type="text/javascript">
this.randomtip = function(){
var length = $("#tips li").length;
var ran = Math.floor(Math.random()*length) + 1;
$("#tips li:nth-child(" + ran + ")").show();
};
$(document).ready(function(){
randomtip();
});
</script>
Re read the article and check you have everything in place correctly.
What a curious approach since those tips are hard-coded in the footer.php anyway. But yeah, why serve a random tip from the first when you can use jQuery instead? :-/ Also, why is this a list when there’s only one item supposed to be visible anyway? It could be done as simple as
<div id="tips">
<?php
$tips = [
'<a href="http://www.wpbeginner.com/">WPBeginner Link is the First Item</a>',
'<a href="http://www.wordpress.org/">WordPress.org is the Second Item</a>'
];
echo $tips[array_rand($tips)];
?>
</div>
I only want one message to display and honestly, I do not need it to be a link. I am just trying to set up a floating footer bar to display a message on. Is there a better code for this than the one I linked to?