Easy Guide to Add Content Locking in WordPress

In this tutorial, we will learn how to add content locking in WordPress without annoying users.

What is Content Locking & When You Need It?

Content Locking is a technique used by site owners. It forces users to perform an action before getting access to your content.

Content lock example

If it is not used properly, then it could annoy your users. But when it is done right, it could be very effective in generating leads and achieving your marketing goals.

The best time to use content locking is when you are offering highly valuable content such as a free course, an ebook download, or something similar.

It uses the same psychological trick as content upgrades. Users wouldn’t mind performing a little task in exchange of valuable content.

Now that you know the use case, let’s see how you can easily add content locking in WordPress like a pro.

What Do You Need for Content Locking in WordPress?

For this tutorial, we will be using OptinMonster. It is the best lead generation solution in the market. You will need a plus or pro plan of OptinMonster for content locking.

WPCademy users can get a 10% discount by using this OptinMonster coupon.

Adding Content Locking in WordPress

First thing you need to do is install and activate the OptinMonster plugin. For more details, see our step by step guide on how to install a WordPress plugin.

This plugin is just a connector between your WordPress site and your OptinMonster account.

Upon activation, click on the OptinMonster menu item in your WordPress admin bar. You will be asked to provide your OptinMonster API username and key.

Authentic OptinMonster account

You can find the API information under your account on the OptinMonster website. Simply login and then click on the API link.

OptinMonster API Keys

Next, copy and paste the API username and key into the OptinMonster plugin page and then click on connect to OptinMonster button.

Once you are successfully connected, you need to click on the create new optin button.

New optin

This will take you to the OptinMonster website. You need to provide a title for your optin campaign and select your website from the drop down menu.

You also need to select ‘After post / Inline’ as your optin type. This will load some ready to use templates in the right column. Click on a template to use it as a starting point.

Create new optin screen

It will open OptinMonster’s form builder where you can customize the appearance of your optin and configure its settings.

Feel free to edit fonts, add text or images, change colors, etc.

OptinMonster's optin builder

Next you need to click on the ‘Optin’ Menu and scroll down to content blocking section. Turn on content blocking for this optin by clicking on the on/off switch.

Turn on content blocking for this optin

Turning it on will show you the options to determine how you want content blocking to work. First you need to choose a content blocking method.

You can use obfuscation which blurs content, or removal which totally removes the content below optin.

Content blocking options

You also need to change success cookie duration to 0. This will prevent cookie from being set until users submits the optin.

After that go through the Integration setting to connect your email marketing service and also configure the analytics setting.

Once you are done, click on the Save button on the top right corner of the builder to save your settings.

Save your optin and get the embed code

Now you need to visit your WordPress site and click on the OptinMonster menu.

You will see your content lock optin under the list of optins. If you don’t see it, then click on refresh optins button.

Edit optin output settings

Take your mouse to the optin title and then click on ‘Edit optin output settings’ link.

On the next page, click on the checkbox below ‘Enable optin on site’ option.

Enable optin on site

Don’t forget to click on the save settings button at the bottom of the page.

Next, you need to click on the OptinMonster menu again to go back to Optins overview page. This time you need to copy the optin slug.

Copy the optin slug

Now you need to edit the post or page where you want to enable content locking and add this shortcode before any other content in your post (or after the first paragraph).

Replace your-optin-slug with the optin slug you copied earlier.

OptinMonster Shortcode

Now you can save and publish your post or page. Visit the post or page in a new browser window to see content locking in action.

How to Add Content Lock to All WordPress Posts

If you want to automatically add content locking to all your WordPress posts, then there is an easier way to do this.

Simply install and activate the Insert Post Ads plugin.

Upon activation, you need to visit Post Adverts » Settings to configure the plugin settings.

Post ad settings

Select where you want to enable post ads plugin posts or pages and then click on save settings button.

Now you need to visit Post Adverts » Add New page. Provide a title for this content locking script and then add your content lock optin shortcode in the advert code section.

Site wide content lock in WordPress

Under ‘Display the advert’ dropdown menu, you can select before the content or choose to add this after the first paragraph and click on the publish button.

That’s all, the plugin will now enable content locking for all your WordPress posts.

Pro Tip: The reason why you may want to add it after the first paragraph is because you can use the first paragraph as a teaser to tell users why they really need to read the rest.

We hope this tutorial helped you add content locking in WordPress.

Easy Guide of Inspect Element: Customizing WordPress for DIY Users

In this tutorial, we will learn the basics of inspect element and how to use it with your WordPress site.

 Inspect Element or Developer Tools

Modern web browsers like Google Chrome and Mozilla Firefox has built-in tools which allow web developers to debug errors. These tools show the HTML, CSS, and JavaScript code for a page and how the browser executes the code.

Using Inspect Element tool, you can edit HTML, CSS, or JavaSCript code for any webpage and see your changes live (only on your computer).

For a DIY website owner, these tools can help you preview how a site design would look without actually making the changes for everyone.

For writers, these tools are awesome because you can easily change personal identifying information when taking your screenshots eliminating the need to blur out items altogether.

For support agents, it’s a great way to identify the error that could be causing your galleries to not load or your sliders to not work properly.

We’re just scratching the surface of use-cases. Inspect element is really powerful.

In this article, we will be focusing on Inspect Element in Google Chrome because that’s our browser of choice. Firefox has its own developer tools which can also be invoked by selecting inspect element from browser menu.

Launching Inspect Element and Locating The Code

You can launch inspect element tool by pressing CTRL + Shift + I keys on your keyboard. Alternately you can click anywhere on a web page and select inspect element from browser menu.

Inspect menu

Your browser window will split into two, and the lower window will show the web page’s source code.

The developer tool window is further divided into two windows. On your left, you will see the HTML code for the page. On the right-hand pane, you will see the CSS rules.

HTML and CSS Panes in Inspect window

As you move your mouse over the HTML source you will see the affected area highlighted on the web page. You will also notice CSS rules change to show the CSS for the element you are viewing.

Editing a particular HTML element

You can also take the mouse pointer to an element on the web page, right click and select inspect element. The element you pointed at will be highlighted in the source code.

Editing and Debugging Code in Inspect Element

Both the HTML and CSS in the inspect element window are editable. You can double click anywhere in the HTML source code and edit the code as you like.

Editing HTML code in inspect element tool

You can also double click and edit any attributes and styles in the CSS pane. To add a custom style rule click on the + icon at the top of CSS pane.

Editing CSS in the inspect element tool

As you make changes to the CSS or HTML those changes will be reflected in the browser instantly.

Live CSS changes in the browser screen

Note, that any changes you make here are not saved anywhere. Inspect element is a debugging tool, and it does not write your changes back to the files on your server. This means that if you refresh the page, all your changes will be gone.

To actually make the changes, you will have to edit your WordPress theme’s stylesheet or relevant template to add the changes you want to save.

Before you start editing your existing WordPress theme using Inspect Element tool, make sure you that you save all your changes by creating a child theme.

Easily Find Errors On Your Site

Inspect element has an area called Console which shows all the errors that exist on your website. When trying to debug an error or requesting support from plugin authors, it’s always helpful to look here to see what the errors are.

Browser Console Error

For example, if you were an OptinMonster customer wondering why your optin is not loading, then you can easily find the problem “your page slug does not match”.

If your sharebar wasn’t working properly, then you can see that there’s a JavaScript error.

Tools like the Inspect Element Console and SupportAlly help you get better customer support because the technical support team love customers who take initiative in providing detailed feedback of the issue.

We hope this tutorial helped you learn the basics of inspect element and how to use it with your WordPres site.

Easy Guide to Disable RSS Feeds in WordPress

In this  tutorial, we will learn how to disable RSS feeds in WordPress.

Method 1:  Disable RSS Feeds Using a Plugin

This method is easier and is recommended for beginners.

First thing you need to do is install and activate the Disable Feeds plugin. For more details, see our step by step guide on how to install a WordPress plugin.

The plugin works out of the box and it will start redirecting users to your website when they request an RSS feed.

There are a few settings available for the plugin. You need to visit Settings » Reading page to configure them.

Disable Feeds plugin settings

By default, the plugin will try to redirect users to related content on your site when they request a feed. For example, users requesting a category feed will be redirected to category page. Users trying to access custom post type RSS feed will be redirected to the custom post type archive.

You can change this behavior and show users a 404 error page.

You can also select not to disable the global RSS feed and comments feed. This will allow users to still subscribe to your RSS feed, but there will be no individual category, author, or post comment feeds.

Don’t forget to click on the save changes button to store your settings.

Method 2: Manually Disable RSS Feeds in WordPress

This method requires you edit WordPress files. You can use this method if you are comfortable pasting snippets from web into WordPress.

Simply add this code to your theme’s functions.php file or a site-specific plugin.

function wpb_disable_feed() {
wp_die( __('No feed available,please visit our homepage!') );
}
 
add_action('do_feed', 'wpb_disable_feed', 1);
add_action('do_feed_rdf', 'wpb_disable_feed', 1);
add_action('do_feed_rss', 'wpb_disable_feed', 1);
add_action('do_feed_rss2', 'wpb_disable_feed', 1);
add_action('do_feed_atom', 'wpb_disable_feed', 1);
add_action('do_feed_rss2_comments', 'wpb_disable_feed', 1);
add_action('do_feed_atom_comments', 'wpb_disable_feed', 1);

This code simply returns an error page when someone requests an RSS feed.

Feeds disabled error page in WordPress

We hope this tutorial helped you learn how to disable RSS feeds in WordPress.

Easy Guide to Add an Admin User in WordPress using FTP

In this tutorial, we will learn how to add an admin user in WordPress using FTP.

Add an Admin User in WordPress Using FTP

Sometimes you may forget your username or email address on a WordPress site and cannot login to the admin area.

One way to do this is by adding an admin user to the WordPress database using MySQL. But you may be unable to connect to phpMyAdmin or don’t want to run MySQL queries directly.

Some users may get their site hacked and admin account deleted. In that case, adding an admin user using FTP can quickly restore your access to the WordPress admin area.

Having said that, let’s see how you can easily add an admin user in WordPress using FTP access.

Adding an Admin User in WordPress Using FTP

First thing you will need is an FTP client. If you are new to using FTP, then see our guide on how to use FTP to upload files in WordPress.

Once connected to your WordPress site, you need to locate your WordPress theme’s functions.php file. It would be at a location like this:

/yoursite.com/wp-content/themes/your-current-theme/functions.php

Right click on functions.php file and then select download. Your FTP client will download the functions.php file to your computer.

Downloading functions.php file to edit

Open the file you just downloaded on your computer using a plain text editor like Notepad. Now you need to add this code at the bottom of the file.

function wpb_admin_account(){
$user = 'Username';
$pass = 'Password';
$email = '[email protected]';
if ( !username_exists( $user )  && !email_exists( $email ) ) {
$user_id = wp_create_user( $user, $pass, $email );
$user = new WP_User( $user_id );
$user->set_role( 'administrator' );
} }
add_action('init','wpb_admin_account');

Don’t forget to replace Username, Password, and [email protected] with your own values.

Next, save the file and then upload it back to your website using the FTP client.

You can now visit your WordPress site’s login area and sign in with the user account you just added.

Once you have logged in to your WordPress site, please edit the functions.php file and delete the code you added. Deleting the code will not remove the user you added, and you can always add new users and authors to your WordPress site.

We hope this tutorial helped you learn how to add an admin user to WordPress using FTP.

Easy Guide to Add Free SSL in WordPress with Let’s Encrypt

In this tutorial, we will learn how to add free SSL in WordPress with Let’s Encrypt.

What is SSL and Let’s Encrypt?

Every internet user shares lots of personal information each day. We do that when shopping online, creating accounts, signing into different websites, etc.

If not properly encrypted, then this information can be spied upon and stolen. This is where SSL comes in. It provides the encryption technology to secure the connection between a user’s browser and the web server.

Each site is issued a unique SSL certificate for identification purposes. If a server is pretending to be on HTTPS, and it’s certificate doesn’t match, then most modern browsers will warn the user from connecting to the site.

Unsecure connection warning in Google Chrome

Previously, the only way to secure sites with SSL was by using a paid SSL certificate.

Let’s Encrypt is a free open certificate authority that aims to provide SSL certificate for general public. It is a project of Internet Research Group, a public service corporation. Let’s Encrypt is sponsored by many companies including Google, Facebook, Sucuri, Mozilla, Cisco, etc.

Let's Encrypt

Having said that, let’s take a look at how you can add free SSL certificate to your WordPress site with Let’s Encrypt.

Easy Way – Using a Host That Offers Built-in Free SSL

As Let’s Encrypt is becoming popular, some WordPress hosting companies have already started offering built-in easy SSL set up.

The easiest way to add Let’s Encrypt free SSL to WordPress is by signing up with a hosting company that offers a built-in integration.

Setting up Free SSL with Let’s Encrypt on SiteGround

SiteGround is one of the most trusted and well-known hosting companies offering built-in integration of free SSL. We use Siteground for our List25 website.

Here is how to enable Let’s Encrypt free SSL in SiteGround.

Simply login to your cPanel dashboard and scroll down to the security section. There you will need to click on the Let’s Encrypt icon.

Let's Encrypt icon in cPanel

This will bring you to the Let’s Encrypt install page. You will need to select the domain name where you want to use the free SSL, and then provide a valid email address.

Installletsencrypt

You can now click on the install button. Let’s encrypt will now issue a unique SSL certificate for your website. Once it’s finished, you will see a success message.

Let's Encrypt installed

That’s all, you have successfully integrated Let’s Encrypt free SSL to your WordPress site.

However, your WordPress site is not yet ready to use it. First you will need to update your WordPress URLs and then fix insecure content issue.

Don’t worry we will show you how to do that. Skip to the section on updating URLs and fixing insecure content issues.

Setting up Free SSL with Let’s Encrypt on DreamHost

DreamHost is another popular WordPress hosting service provider that’s offering built-in integration to setup free SSL on any of your domains hosted with them.

First you need to login to your Dreamhost dashboard. Under the Domains section, you need to click on secure hosting.

Secure Hosting

On the secure hosting page, you need to click on ‘Add Secure Hosting’ button to continue.

Dreamhost will now ask you to select your domain. Below that it will give you an option to add free SSL certificate from Let’s Encrypt. You need to make sure that this checkbox is checked.

Adding secure hosting

You can optionally choose to add a unique IP to your domain name. It is not required, but will improve compatibility with older versions of Internet Explorer on Windows XP.

Click on Add Now button to finish the setup. DreamHost will now start setting up your Free SSL certificate with Let’s encrypt. You will see a success message like this:

Success message after adding free SSL on DreamHost

You have successfully added a free SSL certificate with Let’s Encrypt to your WordPress site on DreamHost.

You still need to update WordPress URLs and fix insecure content issue. Jump to the section, updating WordPress URLs after setting up SSL.

Installing Let’s Encrypt Free SSL on Other Web Hosts

Let’s Encrypt free SSL is a domain based SSL certificate. This means that if you have a domain name, then you can add it on any web host.

However, if your web host does not offer an easy integration like SiteGround or DreamHost, then you will need to go through a somewhat lengthy procedure.

This procedure differs from one web host to another. Most hosting companies have a support document explaining how to do that. You can also contact their support staff for detailed instructions.

BlueHost one of the official WordPress hosting providers allows you to add third-party SSL to your domains hosted with them. For detailed instructions, take a look at their SSL installation of 3rd party certificate page.

Updating WordPress URLs After Setting up SSL

After setting up the Free SSL certificate with Let’s Encrypt, the next step is to move your WordPress URL from HTTP to HTTPS.

A normal site without SSL certificate uses HTTP protocol. This is usually highlighted with http prefix in web addresses, like this:

http://www.example.com

Secure websites with SSL certificates use HTTPS protocol. This means that their addresses look like this:

https://www.example.com

Without changing the URLs in your WordPress site, you will not be using SSL and your site will not be secure for collecting sensitive data.

Having said, let’s see how to move WordPress URLs from http to https:

For Brand New WordPress Website

If you are working on a brand new website, then you can just go to your WordPress admin area and click on settings. There you will need to update the WordPress URL and Site URL fields to use https.

Setting up WordPress to use HTTPS in URLs for a new website

Don’t forget to save your changes.

For Existing WordPress Sites

If your site has been live for a while, then chances are that it is indexed by search engines. Other people may have linked to it using http in the URL. You need to make sure that all traffic is redirected to the https URL.

First thing you need to do is install and activate the Really Simple SSL plugin. For more details, see our step by step guide on how to install a WordPress plugin.

The plugin will automatically detect your SSL certificate and set up your website to use it. In most cases, you will not have to make any more changes. The plugin will also fix insecure content issue.

Update Google Analytics Settings

If you have Google Analytics installed on your WordPress site, then you need to update its settings and add your new url with https.

Login to your Google Analytics dashboard and click on ‘Admin’ at the top menu. Next, you need to click on property settings under your website.

There you will see the default URL option. Click on http and then select https.

Changing default URL in Google Analytics

Don’t forget to click on the save button to store your settings.

More Options:

How To Install Let’s Encrypt SSL With Nginx on CentOS 7

How To Install Let’s Encrypt SSL on Ubuntu With Apache

That’s all, we hope this tutorial helped you add Free SSL in WordPress with Let’s Encrypt.

Easy Guide to Display All Your WordPress Posts on One Page

In this tutorial, we will learn how to display all your WordPress posts on one page without pagination.

Why and When to Display All Posts on One Page?

WordPress comes with built in archive pages for each category, tags, author, and date.

Many site owners however prefer to create custom archives page for their site. The archives page usually highlight their popular posts, display a date based compact archive, list categories, or display tag clouds, and more. Take a look at WPCademy’s archives page as an example.

Some blogs prefer to simply display a list of all their WordPress post titles on one page.

Showing All WordPress Posts on One Page

There are many different ways to display all your WordPress posts on a single page. You can display posts on a page with a shortcode, you can display posts on a page using a plugin, and lastly you can display all posts on a page using a custom template and loop.

We will cover all three methods starting with the most beginner friendly one.

Method 1: Using Display Posts Shortcode Plugin

First thing you need to do is install and activate the Display Posts Shortcodeplugin. For more details, see our step by step guide on how to install a WordPress plugin.

This plugin works out of the box, and there are not settings for you to configure.

Go ahead and create a new page and call it Archives or any other title. After that, you need to paste the following shortcode in your page.

 [display-posts posts_per_page="1000" order="DESC"]

This shortcode will simply display a list of all your post titles in a chronological order. It is set to display maximum 1000 posts per page.

If you have more than a thousand posts, then you can change that. You can also change the post order to ASC which will display posts in a reverse chronological order (older posts first).

List all posts in WordPress

While you could use the display posts shortcode to show excerpts, thumbnails, and other related information, we don’t recommend doing that. When you are listing all your posts on a single page, this page will be long, and you want to make sure it’s simple and fast. Just displaying post titles is sufficient for archives page of this style.

If you want to display posts on page based on category or other parameters, you can do so by following the detailed usage instructions on their documentation page.

Method 2: Using Simple Yearly Archive Plugin

Showing all your WordPress posts on a single page can make it too long to scroll. You can fix that by showing a list of each year. Users can then click on a year to expand it and see the posts published that year.

First thing you need to do is install and activate the Simple Yearly Archiveplugin.

Upon activation, you need to go to Settings » Simple Yearly Archive page to configure plugin settings.

Simple yearly archive settings

The plugin allows you to display list of posts in a variety of ways. You can show them all under links to yearly archives, or you can show them under collapsible years.

If you want to display them under collapsible years, then you need to add

and

next to the option ‘Before / After (Year headline)’.

Rest of the plugin options are quite self-explanatory. You can set them up according to your needs.

Don’t forget to click on the save changes button to store your settings.

Now to display all your posts on a page, you just need to add [SimpleYearlyArchive] shortcode to the page of your choice.

Collapsible yearly archives showing all posts in WordPress

The plugin provides a range of parameters that can be used with the shortcode. You can look at the parameters on plugin’s documentation page.

Method 3: Display All WordPress Posts in One Page with Template Code

While using a plugin to display all posts in one page is the easiest way, some of you may want to learn how to do it with page templates code.

First you will need to create a custom page template and copy the styling from your page.php file.

After that, you will use a loop below to display all posts in one page.

'post', 'post_status'=>'publish', 'posts_per_page'=>-1)); ?>
 
have_posts() ) : ?>
 have_posts() ) : $wpb_all_query->the_post(); ?>
 	<a href="">

If the above code instructions does not make sense, the we recommend that you use method 1.

We hope this tutorial helped you display all your WordPress posts on one page.

Easy Guide to Create Custom Permalinks in WordPress

In this tutorial, we will learn how to create custom permalinks in WordPress without affecting your SEO.

What is a Custom Permalink?

WordPress comes with a handy option to create SEO friendly URL structure called Permalinks for your site. All you have to do is go to Settings » Permalinks page and choose a URL structure.

The permalinks settings page in WordPress

There are a number of options to choose from, and you can even specify a custom structure. Take a look at our SEO Friendly URL Structure for WordPressarticle to learn how to use permalinks in WordPress.

Choosing a permalink structure affects all posts and pages (both new and old) on your WordPress site, so you have to be careful when changing this.

But what if you want to use a different URL for only some posts on your site? What if you want to have a custom permalink for your custom post types? Maybe you want to have a custom permalink for your categories and tags? That’s when you need a custom permalink.

Custom permalink is basically a URL structure applied to that particular item in WordPress without affecting the rest of your URL structure.

Let’s take a look at how you can create custom permalinks in WordPress.

Creating Custom Permalinks in WordPress

There are two ways to creating a custom permalink in WordPress. Often when users are talking about changing the permalink of a WordPress post, they are really talking about the post slug. We will show you how to change the post slug.

But in some cases, users may want to create a completely custom URL structure, and we will also show you how you can do that in WordPress.

Method 1. Changing The Slug Part of a Permalink

In WordPress, the term slug is used for the url friendly name of a post, page, tag, or category. It is automatically generated by WordPress and used in URL when you create a new item.

For example, a post titled “20 Most Amazing Coffee Shops in Manhattan”, WordPress would generate a post slug like this 20-most-amazing-coffee-shops-in-manhattan. Depending on what permalink structure you have, your post URL will look something like this:

http://example.com/2016/02/20-most-amazing-coffee-shops-in-manhattan/

Same thing happens for your pages, custom post types, tags, categories, custom taxonomies, etc.

Now if you just want to change that slug part of the permalink, then that’s easy. You can do that without installing any plugins or writing any code.

Method 2. Changing Slug of a Post or Page

The easiest way to change the slug part of a URL for a WordPress post and page, or custom post types is by editing them.

On the post edit screen, look just below the post title and you will see the post URL with an edit button next to it.

Changing post slug in WordPress

Clicking on this edit button will allow you to change the post slug. You can use alpha-numeric characters and dashes in your post slug.

For a more SEO friendly URL, make sure you choose a post slug that contains keywords people would use to search for that content.

Changing Slug of Categories and Tags

Changing the slug of categories and tags is also very easy. Simply go to Posts » Categories and WordPress will show you the list of categories.

Edit categories in WordPress

You can take your mouse over to a category and click on the quick edit link. WordPress will show you the title of the category, and its URL slug. You can change the URL slug and click on the Update button to save your changes.

Changing category slug using quick edit

Same method applies for tags and custom taxonomies as well.

Method 3. Creating Completely Custom Permalinks

Changing post slug does not change your actual permalink structure. What if you wanted to change permalink for single post, post, page or taxonomy?

For example, if your post URL is like this:

http://example.com/2016/02/20-most-amazing-coffee-shops-in-manhattan/

And you want to change it to something like this:

http://example.com/best-lists/coffee-shops/top-coffee-shops-in-manhattan/

Let’s take a look at another example. Your category URL in WordPress is like this:

http://example.com/category/travel

For that particular category, you want to change it to something like:

http://example.com/travel/

Normally this would require you to change your permalink structure, but that would affect all URLs on your site.

Here is how you would create a custom permalink safely without affecting any other URLs on your site.

First thing you need to do is install and activate the Custom Permalinks plugin.

Upon activation, you can simply edit a post or page and change its URL to anything you want.

Custom permalink for a single post

You can also edit categories and tags. Simply go to Posts » Categories and click on the edit link below the category you want to change.

On the edit category page, scroll down to the bottom and you will see the custom permalink field.

Custom Permalink for a single category in WordPress

You can do the same for tags and custom taxonomies as well.

Setting up Redirects for Custom Permalinks in WordPress

When you are adding a custom permalink for a new post, then you don’t have to worry about redirects.

On the other hand, if you are changing the URL of an already published post, then you need to setup proper redirects.

Users coming to the old address from search engines and other websites, will not be able to find that page unless you setup redirects.

Same goes for your categories and tags. If a category/tag archive page was indexed, then it would become unavailable when you change the URL.