Affichage des articles dont le libellé est Sticky. Afficher tous les articles
Affichage des articles dont le libellé est Sticky. 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 Make Your Site Sticky



alt="How to Make Your Site Sticky" src="http://whsr.webrevenueinc1.netdna-cdn.com/wp-content/uploads/2012/06/sticky-note-500x375_c.jpg" />

Why do some websites attract more visitors and keep them coming back again and again? It’s something called the sticky factor and there are some things that any website owner can do to make their site one that visitors want to hang out on.

Give Your Visitors Something to Do

class="border" title="Sample of Sticky Site" src="http://www.webhostingsecretrevealed.net/images/2012/0621-4.jpg" alt="" width="750" />

Probably one of the best ways to get visitors to come to your site and stay there is to offer things for them to do that keeps them engaged. Social networking has become more and more popular as people learn new ways to connect online. One of the most popular social networking sites out there is Facebook. The reason for Facebook’s popularity is complex, but consider the things you do in a typical day at Facebook.  You can see what friends are up to, share photos and updates with others, play games, view videos, get coupons, see ads and on and on. While most websites don’t want to take on the complexity of Facebook, think about things you can add that might keep visitors on your page or encourage them to return:

  • Forums
  • Contests
  • Games
  • Polls
  • Daily updates (jokes, quotes, interviews, etc.)

Give ‘Em What They Expect

class="border" title="Sample of Sticky Site" src="http://www.webhostingsecretrevealed.net/images/2012/0621-5.jpg" alt="" width="750" />

If your website is about turtles, then focus on all aspects of turtles. Interview a veterinarian about common turtle illnesses, add articles about different types of turtles, sell turtle supplies, or offer a game about turtles. However, don’t include things that are completely unrelated to your topic just to try to up your traffic. If you hear that a topic such as Angelina Jolie is trending on Google and Angelina doesn’t own a turtle, then you shouldn’t throw in an article that has nothing to do with turtles. The people who visit your site want to know about turtles and want to know that they can trust you to give them info and features related to turtles.

href="http://turtles.net" target="_blank" rel="nofollow">Turtles.net is an excellent example of a site with a focus. They offer info on turtles, a turtle webcam, turtle forums and turtle videos. What is your site’s focus? Does your visitor trust you to keep that focus?

Site Load Times

class="border" title="Sample of Sticky Site" src="http://www.webhostingsecretrevealed.net/images/2012/0621-6.jpg" alt="" width="750" />

class="border" title="Sample of Sticky Site" src="http://www.webhostingsecretrevealed.net/images/2012/0621-7.jpg" alt="" width="750" />

You can spend untold hours figuring out how to get visitors to your website, but if it doesn’t load quickly, they won’t wait around. Today’s person is used to a fast pace and doesn’t have time to wait for graphics to load. Dial-up, for the most part, is on its way out. Check the load time of your website at href="http://www.iwebtool.com/speed_test" target="_blank" rel="nofollow">http://www.iwebtool.com/speed_test. As a general rule of thumb, your site should load within .30 seconds or less. Any longer and you risk losing your visitors or shortening the amount of time they stay on your site. Although it can be exciting to add features like flash, videos, and graphics, limiting these things will help your site load faster. You must achieve a balance between a visually appealing site and one that loads quickly. One example of a slow-loading website is WebOSNation.com. It takes an average of .73 seconds according to iWebTool’s speed test. On the other hand, Google loads in about .17 seconds on average.

What is bogging your site down? Are there features that take a long time to load? Imagine if your site is slow to load on high-speed Internet, what it might be like for a user on dial-up.

class="meteor-icon" style="font-size:12px !important;">
class="icon-angle-right" style="color:inherit !important;">
Dig deeper: href="http://www.webhostingsecretrevealed.net/blog/seo/speed-up-your-website/">How to speed up your site

Newsletters and Subscriptions

One of the best ways to get visitors to return to your site again and again is to offer an online newsletter or other subscription service. Once you capture the visitor’s e-mail and have him opt in on your mailing list, you can remind him about new features you’ve created, special sales or other events. There are many free or inexpensive newsletter services you can use, which are discussed in the article “href="http://www.webhostingsecretrevealed.net/blog/featured-articles/what-a-newsletter-can-do-for-your-site-and-free-software-to-get-started/">What a Newsletter Can Do for Your Site (and Free Software to Get Started).”

However, you need to do more than just off a newsletter to create that “sticky” factor. The newsletter or other subscription-based item you are offering must offer value to your target audience. If we go back to the example of a website about turtles, you might offer a free turtle-care guide that you send out once a month. You could also offer free videos or webinars instead.

Fresh Content

class="border" title="Sample of Sticky Site" src="http://www.webhostingsecretrevealed.net/images/2012/0621-8.jpg" alt="" width="750" />

When it comes to websites, href="http://www.webhostingsecretrevealed.com/featured-articles/why-content-is-king-and-where-to-get-it/">content truly is king. No matter what type of website you run, adding free and useful information for your visitors will keep them at your site reading. As an added bonus, a particularly useful resource will be shared by your visitors with their family, friends and on social networking sites. This will increase your traffic and multiply the sticker factor. As new people come to visit, they too will see the value of your site and bookmark it.

Groupon.com is an excellent example of providing regular, fresh content that is of value to visitors. Groupon offers discounts for local retailers, but has deals all around the country. When you visit Groupon, you choose a large city nearest to your location. Groupon then updates almost daily with new deals. If you sign up for their mailing list, they will also e-mail you deals. This is brilliant stickiness on the part of Groupon, because those e-mails are often forwarded to family and friends who might also be interested in a given deal.

class="meteor-icon" style="font-size:12px !important;">
class="icon-angle-right" style="color:inherit !important;">
Dig deeper: href="http://www.webhostingsecretrevealed.net/blog/web-business-ideas/how-popular-websites-use-high-posting-frequencies-to-succeed/">How popular websites are using high posting frequencies to succeed

Make it Easy to Visit Your Site

class="border" title="Sample of Sticky Site" src="http://www.webhostingsecretrevealed.net/images/2012/0621-9.jpg" alt="" width="750" />

If the goal of a sticky site it to have visitors return time and time again, then make it easy for them to remember where your site is. Here are some tips for making it easy to visit your site:

  • Add a link so they can bookmark with a single click
  • Have a Facebook and Twitter presence
  • Consider new and growing social networking sites like Pinterest
  • Add a link to your site in e-mails you sent out, so subscribers can simply click and visit
  • Choose a domain that is easy to remember

On that last point, you likely already have a domain name for your site. If your domain name is long-winded, such as href="http://AllAboutTurtles-BecauseILoveThem.com" rel="nofollow">http://AllAboutTurtles-BecauseILoveThem.com, visitors are not likely to remember that name. However, short and simple names are typically already taken. You can try to purchase one of those names or you can come up with something related. If your domain is already in place, simply park the easier domain on top and use it in advertising. There is a site that pokes fun at this concept. It is href="http://www.llanfairpwllgwyngyllgogerychwyrndrobwyll-llantysiliogogogoch.com" target="_blank" rel="nofollow">http://www.llanfairpwllgwyngyllgogerychwyrndrobwyll-llantysiliogogogoch.com. Now, that is a hard domain name to remember!

You should also try to avoid dashes or words that are difficult to translate in speech, such as when you are doing a radio interview and want to share your domain. Avoid words with multiple spellings like to/two/too or here/hear.

If you start with these few sweet points, your domain will be sticky in no time. There are additional elements you can add over time that will keep visitors returning, but always keep things simple, make sure your site loads quickly, ensure things are easy to find and provide as much value as possible. If you focus on those concepts, your site will be a success.

class="meteor-icon" style="font-size:12px !important;">
class="icon-angle-right" style="color:inherit !important;">
Dig deeper: href="http://www.webhostingsecretrevealed.net/blog/web-business-ideas/77-ways-to-drive-traffic-to-your-website/">77 ways to drive traffic to your website.


Page 23 – Web Hosting Secret Revealed