Affichage des articles dont le libellé est Footer. Afficher tous les articles
Affichage des articles dont le libellé est Footer. Afficher tous les articles

samedi 12 novembre 2016

How to Create a “Sticky” Floating Footer Bar in WordPress



Do you want to create a sticky floating footer bar in WordPress? We have been using the floating footer bar on our website for many years because it helps us reduce bounce rate and increase pages viewed by users. Many of you have asked us how to create a similar floating bar, so here it is. In this article, we will show you how to create a sticky floating footer bar in WordPress.


Floating Footer Bar


What is Floating Footer Bar?


A sticky floating footer bar allows you to prominently display your important content to users. This bar remains visible to users at all time, so they are more likely to click on it and discover more useful content.


WPBeginner Footer Bar


You can use the floating footer bar to:



  • Drive more clicks to other blog posts

  • Build your email list

  • Bring attention to special offers / sale


In this article, we will show you two methods to add a sticky floating footer bar on your WordPress site. One uses a plugin while the other is a code method that we’re using on WPBeginner. You can choose the one you find easier to use.


Method 1: Manually Create Sticky Floating Footer Bar in WordPress


This method requires you to add code in your WordPress files. If you are new to adding code, then please take a look at our guide on how to paste snippets from web into WordPress.


First, you need to connect to your WordPress site using an FTP client or file manager in cPanel.


In your FTP client, you need to locate the footer.php file in your WordPress theme folder and download it to your desktop. It would be located at a path like this:


/wp-content/themes/your-theme-folder/


Next, you need to open the footer.php file in a plain text editor like Notepad and add the following code just before the </body> tag.



<div class="fixedBar">
<div class="boxfloat">

<ul id="tips">
<li><a href="http://www.wpbeginner.com/">WPBeginner Link is the First Item</a></li>
<li><a href="http://www.wordpress.org/">WordPress.org is the Second Item</a></li>
</ul>

</div>
</div>

You can add as many list items as you want. We will show you how to randomly rotate them on each page load.


The next step is adding the CSS styles.


You can add CSS to your WordPress theme’s style.css file or use the Simple Custom CSS plugin.



/*WPBeginner Footer Bar*/

.fixedbar {
background: #000;
bottom: 0px;
color:#fff;
font-family: Arial, Helvetica, sans-serif;
left:0;
padding: 0px 0;
position:fixed;
font-size:16px;
width:100%;
z-index:99999;
float:left;
vertical-align:middle;
margin: 0px 0 0;
opacity: 0.95;
font-weight: bold;
}
.boxfloat {
text-align:center;
width:920px;
margin:0 auto;
}

#tips, #tips li {
margin:0;
padding:0;
list-style:none
}
#tips {
width:920px;
font-size:20px;
line-height:120%;
}
#tips li {
padding: 15px 0;
display:none;
}
#tips li a{
color: #fff;
}
#tips li a:hover {
text-decoration: none;
}

After adding the CSS, you may not be able to see the changes on your website. This is because we have set the display for items in our list to none.


Next, we will use jQuery to randomly display one item from our list on each page load.


You need to open a plain text editor like Notepad on your computer and add this code to a blank file:




(function($) {
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();
});
})( jQuery );


Once you are done, you need to save this file as floatingbar.js on your desktop.


Now open your FTP client and connect to your web server. Go to your theme folder and locate js folder. It would be at a path like this:


/wp-content/themes/your-theme-folder/js


If there is no js folder in your theme directory, then you need to create one.


Now you need to upload floatingbar.js file you created earlier to the js folder you just created.


The next step is to enqueue (load) the JavaScript file in your WordPress theme.


Paste this code in your theme’s functions.php file or a site-specific plugin.



function wpb_floating_bar() {
wp_enqueue_script( 'wpb-footerbar', get_stylesheet_directory_uri() . '/js/floatingbar.js', array( 'jquery' ) );
}
add_action( 'wp_enqueue_scripts', 'wpb_floating_bar' );

That’s all, you can now visit your website to see the floating footer bar in action. Reload the page a couple of times to see footer bar randomly showing different items from your list.


The benefit of using this method is that you get to randomly rotate multiple links in the floating footer bar like we’re doing.


However the difficulty is that you need to add code. Furthermore, you can’t use this floating bar for other things without doing too much CSS customizations.


Method 2: Using OptinMontser to Add Floating Footer Bar in WordPress


OptinMonster is a popular lead generation plugin that works on all websites. It helps you convert website visitors into subscribers and customers.


One of the features OptinMonster has is a floating header and footer bar that you can use to display an email optin form as well as to promote single links / offers.


The benefit of using this method is:



  • Easy to Setup (no code)

  • You can show custom floating bars on different pages / categories of your website.

  • You can use it to build your email list as well as promote offers.


The only downside is that OptinMonster is a paid service. But you can use our OptinMonster Coupon: WPB10 to get 10% discount on any OptinMonster plan.


After you have purchased OptinMonster (Plus or Pro plan), you can use the OptinMonster WordPress API plugin on your site. For more details, see our step by step guide on how to install a WordPress plugin.


This plugins just acts as a connector between your WordPress site and OptinMonster.


Upon activation, the plugin will add a new menu item labeled OptinMonster to your WordPress admin bar. Clicking on it will take you to plugin’s settings page.


Connect your WordPress site to OptinMonster


You will be asked to provide your OptinMonster API username and key. You can get these keys from your OptinMonster account.


OptinMonster API keys


Copy and paste the keys into the plugin settings and click on ‘Connect to OptinMonster’ button. The plugin will now connect your WordPress site to your OptinMonster account.


Next, you need to click on the ‘Create New Optin’ button.


Create a new optin


This will take you to ‘Create New Optin’ page on OptinMonster website.


First you need to provide a title for your Optin Campaign and select a website where you will be using this optin. If your site is not listed then click on ‘Add a new website’ link.


Optin Settings


Next, you can click on the Floating bar under the ‘Select your optin type’ to use templates available to use as a floating bar.


You can customize all these templates to your own liking. Select the one that looks closest to what you have in mind.


As soon as you select a template, OptinMonster will launch their design customizer. It is a point-and-click builder where you can configure appearance and settings for your optin.


Optin customizer


When you are done configuring the appearance of your optin, be sure to click on the save button.


While these are called optins, they don’t always have to be. You can use the Yes / No feature to add the button to view a blog post or claim a special discount.


When you first create your floating bar, it’s Paused by default.


Once you’ve finished configuring it, hover over to the status bar in the top menu and choose Start Campaign.


Your floating bar is now ready to be added to your WordPress site.


Return to the admin area of your WordPress site and visit OptinMonster » Optins. You will see your optin listed here. If you don’t see it, then click on Refresh Optins button and the plugin will display it.


Click on the ‘Edit output settings’ link to continue.


Optin output settings


On the next page, check the box next to ‘Enable optin on site’ option and then click on the save settings.


You can also use the Advanced option to only show the floating bar on specific posts, pages, categories, and other areas.


That’s all, floating footer bar optin is now live on your WordPress site.


Floating bar added with OptinMonster


We hope this article helped you add a floating footer bar to your WordPress site. You may also want to see these actionable tips to drive traffic to your WordPress site.


If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.


The post How to Create a “Sticky” Floating Footer Bar in WordPress appeared first on WPBeginner.







How to Remove the Powered by WordPress Footer Links



Do you want to remove the powered by WordPress footer links on your site? Recently one of our readers asked if it was possible to remove footer credits in WordPress themes. In this article, we will show you how to remove the powered by WordPress footer links in your themes.


Remove Powered by WordPress Links


The default WordPress themes use the footer area to display the “Proudly powered by WordPress” link. Many theme developers take this further and add their own credits, so it looks something like “Powered by WordPress. Theme by Company Z”.


But if you’re running a business website, then it doesn’t make any sense to display these credits. Some even think that it makes your website look unprofessional.


Is it legal to remove WordPress footer credit links?


We get this question a lot. Yes, it is absolutely legal to remove footer credits link on your WordPress site.


WordPress is free, and it is released under the GPL license.


In short, that license gives you the freedom to use, modify, and even redistribute WordPress. Any WordPress theme or plugin that you download from the official WordPress.org directory, and even most commercial WordPress themes are also released under the same license.


So you have full rights to do what you please with your website including removing the footer credit links.


Let’s take a look at how to customize your WordPress footer and remove these credit links.


Video Tutorial



If you don’t like the video or need more instructions, then continue reading.


Removing WordPress Powered by Links


There are many ways to remove the WordPress footer credit links, but we only recommend the following 2 ways of doing this.


The Theme Settings Page


Most good theme authors know that their users want to have the option to remove footer credit links. That’s why they make it available in their theme settings area.


Different themes have this setting available under different sections. But the first place to start looking is inside the WordPress theme customizer (Appearance » Customize).


For example, the GetNoticed theme by Michael Hyatt give users the option to customize the footer text as well as disable the credit links.


GetNoticed Footer Credits Setting


Other places that you can look are individual theme’s options pages or inside the Widgets section.


Footer.php Code Method


If your theme does not have the option to remove or modify footer credits from WordPress admin, then your only option is to edit the footer.php code.


You can find this file in your /wp-content/themes/yourtheme/footer.php


Simply open this file in a text editor and search for the footer credit text like “Powered by”, and it will show you the section that you need to remove.


In the default Twenty Sixteen theme for WordPress, the code looks like this:



<div class="site-info">
<?php
/**
* Fires before the twentysixteen footer text for footer customization.
*
* @since Twenty Sixteen 1.0
*/
do_action( 'twentysixteen_credits' );
?>
<span class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></span>
<a href="<?php echo esc_url( __( 'https://wordpress.org/', 'twentysixteen' ) ); ?>"><?php printf( __( 'Proudly powered by %s', 'twentysixteen' ), 'WordPress' ); ?></a>
</div><!-- .site-info -->

You can either remove this text entirely or customize it to suit your needs.


Avoid the CSS Method at All Cost


Now some WordPress tutorial sites may show you a CSS method that uses display: none to hide the footer credit links.


However doing so will put your site’s SEO at risk. Google does not like hiding links with display:none because that’s a technique that spammers use to hide the links from users while still showing it to Google (in hopes of higher rankings).


Your site might get flagged, and it will cause you to lose your search engine rankings.


So whatever you do, do not use the CSS method like this:


#site-info {display:none}

While it looks simple, it’s not good for SEO.


We strongly recommend using the two methods that we showed above. If you cannot do either of those, then we recommend hiring a professional to help you remove your footer credit links or even consider changing your WordPress theme.


We hope this article helped you remove the powered by WordPress footer links. You may also want to check out our guide on how to improve your WordPress security.


If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.


The post How to Remove the Powered by WordPress Footer Links appeared first on WPBeginner.