How to Redirect Your User’s Attention with Comment Redirect

Comments are a great way to keep your users engaged and build a strong community around your content. Tiny hacks like comment redirect help you improve user experience and stand out. In this article, we will show you how to easily redirect user’s attention with… Read More »

The post How to Redirect Your User’s Attention with Comment Redirect appeared first on WPBeginner.

Comments are a great way to keep your users engaged and build a strong community around your content. Tiny hacks like comment redirect help you improve user experience and stand out. In this article, we will show you how to easily redirect user’s attention with comment redirect in WordPress.

Redirect Your User’s attention with Comment Redirect

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

Upon activation, you need to visit Settings » Comment Hacks page to configure plugin settings.

Yoast Comment Hacks settings page

Yoast Comment Hacks plugin is a combination of many useful hacks to improve the default WordPress comment system. See our guide on how to install and setup Yoast Comment Hacks for WordPress to learn about all its features.

Right now we will focus on the comment redirect feature in the plugin.

Go ahead and click on the ‘Comment Redirect’ tab on the settings page.

Select a page where you want users to be redirected

Here you need to select a page where you want your first time commenters to be redirected to. This could be a simple thank you page with an email signup form, social media links, and your most popular posts.

You can also redirect users to a landing page, special offer, or a specific lead magnet page.

After selecting your page, don’t forget to click on the save changes button to store your settings.

To see the comment redirect in action, you will need to logout of your WordPress site first. After that go to any post on your website and leave a comment using a random name and email address.

You will be automatically redirected to your selected page when you submit the comment.

Comment redirect page example

Creating A Powerful Comment Redirect Page

Yoast Comment Hacks only redirects first time commenters. This means you only get one shot at converting those users and leaving a meaningful impression.

Here are some tips on creating a powerful comment redirect page.

You can create a beautiful custom page using a drag and drop page builder plugin. We recommend using Beaver Builder which comes with several ready to use page templates that will work perfectly for this purpose.

You also need to set a goal for your comment redirect page. This goal could be any task you would like to see the user perform. For example, buying a product, signing up for your email list, following you on social media, etc.

You can use OptinMonster to capture those leads. It is the best lead generation software that helps you convert abandoning visitors into subscribers and customers.

We hope this article helped you learn how to redirect your user’s attention with comment redirect in WordPress. 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 Redirect Your User’s Attention with Comment Redirect appeared first on WPBeginner.

How to Optimize Your WordPress Database with One Click

Have you ever optimized your WordPress database? Optimizing your database cleans up unwanted data which reduces database size and improves performance. In this article, we will show you how to easily optimize your WordPress database with one-click. Why You Should Optimize Your WordPress Database? If… Read More »

The post How to Optimize Your WordPress Database with One Click appeared first on WPBeginner.

Have you ever optimized your WordPress database? Optimizing your database cleans up unwanted data which reduces database size and improves performance. In this article, we will show you how to easily optimize your WordPress database with one-click.

How to optimize WordPress database

Why You Should Optimize Your WordPress Database?

If you have been using WordPress for a while, then there is probably a lot of useless data in your database such as post revisions, spam comments, trash, transient options, orphaned meta data, and so on.

This data increases your WordPress database size, which means your WordPress backups will take more disk space and time to restore.

Cleaning up this unwanted data significantly reduces your WordPress database size, which means faster backups, easier restore, and improved database performance.

Having said that, let’s see how to easily optimize your WordPress database and remove clutter.

How to Optimize Your WordPress Database

Since you will be working on your WordPress database, you need to make sure that you create a complete WordPress backup before moving forward.

Next, you need to install and activate the WP-Optimize plugin. For more details, see our step by step guide on how to install a WordPress plugin.

This plugin is built by the same team behind the popular WordPress backup plugin, UpdraftPlus.

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

WP-Optimize settings

You will see a list of operations that the plugin will perform on your database. Review them carefully and uncheck any item that you don’t want to run at the moment.

Items marked in red require more intensive database operations. If the process is interrupted during the operation, then it may corrupt data. That’s why we strongly recommend that you create a backup of your website before selecting the items in red.

After selecting the items, click on ‘Run on all selected items’ button at the top.

The plugin will now start optimizing your WordPress database and show you the progress.

That’s all, you have successfully optimized your WordPress database.

Note: If your MySQL database tables are using the InnoDB engine, then WP-Optimize will not perform database table optimization. You can perform that operation manually, using phpMyAdmin. See our beginner’s guide on WordPress database management with phpMyAdmin for detailed instructions.

We hope this article helped you optimize WordPress database. You may also want to see our ultimate guide to boost WordPress speed and performance.

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 Optimize Your WordPress Database with One Click appeared first on WPBeginner.

How to Optimize Your WordPress Database with One Click

Have you ever optimized your WordPress database? Optimizing your database cleans up unwanted data which reduces database size and improves performance. In this article, we will show you how to easily optimize your WordPress database with one-click. Why You Should Optimize Your WordPress Database? If… Read More »

The post How to Optimize Your WordPress Database with One Click appeared first on WPBeginner.

Have you ever optimized your WordPress database? Optimizing your database cleans up unwanted data which reduces database size and improves performance. In this article, we will show you how to easily optimize your WordPress database with one-click.

How to optimize WordPress database

Why You Should Optimize Your WordPress Database?

If you have been using WordPress for a while, then there is probably a lot of useless data in your database such as post revisions, spam comments, trash, transient options, orphaned meta data, and so on.

This data increases your WordPress database size, which means your WordPress backups will take more disk space and time to restore.

Cleaning up this unwanted data significantly reduces your WordPress database size, which means faster backups, easier restore, and improved database performance.

Having said that, let’s see how to easily optimize your WordPress database and remove clutter.

How to Optimize Your WordPress Database

Since you will be working on your WordPress database, you need to make sure that you create a complete WordPress backup before moving forward.

Next, you need to install and activate the WP-Optimize plugin. For more details, see our step by step guide on how to install a WordPress plugin.

This plugin is built by the same team behind the popular WordPress backup plugin, UpdraftPlus.

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

WP-Optimize settings

You will see a list of operations that the plugin will perform on your database. Review them carefully and uncheck any item that you don’t want to run at the moment.

Items marked in red require more intensive database operations. If the process is interrupted during the operation, then it may corrupt data. That’s why we strongly recommend that you create a backup of your website before selecting the items in red.

After selecting the items, click on ‘Run on all selected items’ button at the top.

The plugin will now start optimizing your WordPress database and show you the progress.

That’s all, you have successfully optimized your WordPress database.

Note: If your MySQL database tables are using the InnoDB engine, then WP-Optimize will not perform database table optimization. You can perform that operation manually, using phpMyAdmin. See our beginner’s guide on WordPress database management with phpMyAdmin for detailed instructions.

We hope this article helped you optimize WordPress database. You may also want to see our ultimate guide to boost WordPress speed and performance.

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 Optimize Your WordPress Database with One Click appeared first on WPBeginner.

How to Display Relative Dates in WordPress

Do you want to display relative dates on your WordPress site? Relative dates are used on many popular social media websites like Twitter and Facebook. Instead of showing the date timestamps, these websites show how long ago something was posted. In this article, we will… Read More »

The post How to Display Relative Dates in WordPress appeared first on WPBeginner.

Do you want to display relative dates on your WordPress site? Relative dates are used on many popular social media websites like Twitter and Facebook. Instead of showing the date timestamps, these websites show how long ago something was posted. In this article, we will show you how to display relative dates in WordPress.

How to display relative dates in WordPress

Why and When to Use Relative Dates in WordPress?

As you may have noticed that a lot of social networking websites use relative time to describe how long ago an entry was posted.

For example, two hours ago, yesterday, just now, etc.

Relative date shown on Facebook

Relative dates give users a sense of how much time has passed since something was posted. This is why a lot of WordPress blogs and news sites are adding time ago style relative dates.

Having said that, let’s take a look at how to add relative dates to your WordPress site.

Adding Relative Dates in WordPress Using a Plugin

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

Upon activation, you need to visit Settings » General page and scroll down to ‘Meks Time Ago Options’ section.

Meks Time Ago settings

You can select where and when you want to use relative time. You can choose to show it for date, time. or both. You can also limit it to posts not older than a specific time.

If you run a multilingual site or want to change the text ‘ago’, then you can do that here as well.

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

That’s all, you can now visit your website to see it in action on your posts and comments.

Relative date shown with a WordPress post

Adding Relative Dates in WordPress Manually

This method requires you to install a plugin, but you will also have to add code manually to your WordPress theme.

If this is your first time adding code to your WordPress site, then you may want to see our guide on pasting snippets from web into WordPress.

You may also need to see how to use FTP to edit and upload files to WordPress.

Ready? Let’s get started.

First thing you need to do is install and activate the WP RelativeDate plugin.

Upon activation, the plugin will try to replace the default WordPress dates in your theme with relative date and time.

However, since there are so many WordPress themes using different methods to display date and time, it may not be able to work with your theme.

Visit your website to see if it was able to successfully change date and time to relative dates.

If it does not work for your theme, then you may need to edit your WordPress theme files where you want to show relative date and time.

For example, if you want to show relative date on a single post page, then you will need to edit single.php or content-single.php files. For comments, you may need to edit comments.php file.

Basically, you will be looking for any of these lines in your theme’s template files:

<?php the_date(); ?>
<?php get_the_time(); ?>
<?php get_the_date(); ?>

You will need to replace them with the following line:

<?php relative_post_the_date(); ?>

You may need to edit multiple files in your WordPress theme depending on where you want to display relative dates on your site.

That’s all, you can now visit your website to see relative dates in action.

We hope this article helped you learn how to display relative dates in WordPress. You may also want to see our list of 25 most useful WordPress widgets for your 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 Display Relative Dates in WordPress appeared first on WPBeginner.

How to Add a Printer Friendly Option to Your WordPress Posts

Often users want to print articles they find interesting. By default, WordPress itself and most WordPress themes would print your page as it is, with all the graphics, colors, and text in sidebars. In this article, we will show you how to add a printer… Read More »

The post How to Add a Printer Friendly Option to Your WordPress Posts appeared first on WPBeginner.

Often users want to print articles they find interesting. By default, WordPress itself and most WordPress themes would print your page as it is, with all the graphics, colors, and text in sidebars. In this article, we will show you how to add a printer friendly option to your WordPress posts.

Adding a printer friendly option to WordPress posts

Why and When You Need a Printer Friendly Option for WordPress Posts?

Some WordPress themes come with a separate CSS stylesheet for printing. This stylesheet is used when a user prints a page. Other WordPress themes, may not change your site’s appearance when a user prints it.

Usually this results into users printing all the images, sidebars, headers, menus, etc. Most of the time it is not very pleasant to read or look at.

A typical print preview with sidebars forms all printed

You can see how your WordPress theme handles print by pressing CTRL+P when looking at a page from your site. Your browser will show print preview of your site.

If your theme shows your site as it appears in the browser, then it is not handling print any differently.

In that case, you can use a printer friendly option on your WordPress site. It will not only make your content printer friendly, it will also encourage users to print with an on-screen print icon.

We will be showing you two plugins that can add a print option to WordPress, and you can choose the one that best suits your need.

Method 1: Add Print Button in WordPress with Print Post and Page Plugin

This method is recommended for users who do not want to add code to their WordPress theme files.

First thing you need to do is install and activate the Print Post and Page plugin.

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

Print settings

Here you can choose the print icon size and color, text to accompany the icon, and print alignment. Optionally, you can add custom CSS that you want to include into your print template.

Don’t forget to click on the ‘Save and Activate’ button to store your plugin settings.

You can now visit your WordPress site and you will see a print button on your single posts.

Print button in WordPress post

However, the plugin does not automatically adds print button to your WordPress pages. You will need to add [printicon align="left"] shortcode to your WordPress pages to display the print icon on pages.

Method 2: Adding Printer Friendly Option Using WP-Print

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

Upon activation, you need to visit Settings » Print to configure plugin settings.

Print Options

You can display print icon with text, just the icon, or just the text. You can choose between two icons, and you also change the text that appears with the icon.

Under print options, you will be asked if you want to print comments, links, images, or videos. By default, the plugin does not print comments and videos. You can change that if you want the plugin to print comments and videos as well.

At the bottom of each printed post, the plugin will add a disclaimer/copyright text. By default, it will show your site’s name. You can change that to anything you want, and you can also use HTML tags inside the disclaimer field.

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

Now comes the tricky part. The plugin will not actually add the print button into your posts. You will have to manually edit your WordPress theme files to add the button.

Depending on your theme, you may need to add the code into single.php, page.php, archive.php, content.php, etc.

Locate the line in your theme template that looks like this:

<?php while (have_posts()) : the_post(); ?>

Below this line, you need to add the following code where you want to display the print button:

<?php if(function_exists('wp_print')) { print_link(); } ?>

That’s all, you can now visit your website and you will be able to see the print button.

Print this button

Sometimes you may have content that you do not want to be included into the print version. Simply wrap that content between [donotprint] and [/donotprint] shortcode, like this:

[donotprint]This text will not be displayed when printing[/donotprint]

We hope this article helped you add a printer friendly option to your WordPress posts. You may also want to see our guide on how to add PDF download for posts in WordPress.

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 Add a Printer Friendly Option to Your WordPress Posts appeared first on WPBeginner.

How to Display Breadcrumb Navigation Links in WordPress

Do you want to display breadcrumb navigation links in your WordPress site? Breadcrumb navigation is a secondary navigation system that tell users where they are on a website relative to the homepage. In this article, we will show you how to display breadcrumb navigation links… Read More »

The post How to Display Breadcrumb Navigation Links in WordPress appeared first on WPBeginner.

Do you want to display breadcrumb navigation links in your WordPress site? Breadcrumb navigation is a secondary navigation system that tell users where they are on a website relative to the homepage. In this article, we will show you how to display breadcrumb navigation links in WordPress.

Breadcrumbs displayed on WPBeginner website

What is Breadcrumb Navigation and Why You Need it?

Breadcrumb navigation is a term used to describe a hierarchical navigation menu presented as a trail of links. It is often used as a secondary navigation that allows users to go up and down in the hierarchy of links.

Breadcrumb navigation links are different than the default navigation menu system in WordPress.

The purpose of breadcrumb navigation is to help users navigate around a website. It helps users understand where they are on a site. It also helps search engines understand the hierarchy of links on a web page.

Search engines like Google have started displaying breadcrumbs below the title of a site in the search results. This gives your website more visibility in the results and increases your click through rate.

Breadcrumb navigation in search results

Having said that, let’s take a look at how to add breadcrumb navigation links in WordPress.

Adding Breadcrumb Navigation using Breadcrumb NavXT Plugin

This is by far the easiest way to add breadcrumb navigation in a WordPress site. It is very flexible, easy to use, and has more options that you can imagine. See why we use Breadcrumb NavXT on WPBeginner.

First thing you need to do is install and activate the Breadcrumb NavXT plugin. Upon activation, you need to visit Settings » Breadcrumb NavXT page to configure the plugin settings.

Settings page for Breadcrumb NavXT plugin

The default settings should work for most websites. However you want to make changes to customize the settings as needed.

The settings page is divided into different sections. On the general settings tab, you can define how the plugin behaves globally on your site.

It allows you to modify the beadcrumb navigation links template. You will also notice that these link templates use Schema.org parameters in the link tag.

The post types tab under plugin settings, allows you to setup breadcrumb links for posts, pages, and any custom post types.

You can choose how you want to display post hierarchy. By default the plugin will use Site Title > Category > Post Title. You can replace categories with tags, dates, or post parent.

The taxonomies and authors tabs have the similar templates for your breadcrumb navigation links.

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

Showing Breadcrumb NavXT on Your Website

The plugin requires you to edit your theme files. You need to add this code in your theme or child theme‘s header.php file where you want to display the breadcrumb navigation.


<div class="breadcrumbs" typeof="BreadcrumbList" vocab="http://schema.org/">
    <?php if(function_exists('bcn_display'))
    {
        bcn_display();
    }?>
</div>

That’s all you can now visit your website and see the breadcrumb navigation links by visiting any post or page.

Adding Breadcrumb Navigation Links Using Yoast SEO Plugin

First thing you need to do is install and activate the Yoast SEO plugin. We have a complete step by step guide on how to install and setup Yoast SEO plugin for WordPress.

Upon activation, you need to go to SEO » Advanced page and check the ‘Enable breadcrumbs’ option.

Yoast breadcrumb settings

Once checked, you will find several options to change how breadcrumbs would display on your site. Default settings should work for most folks however feel free to change anything that you like.

Once you are done, click on the save changes button to store your settings.

Showing Yoast’s Breadcrumb Navigation on Your Site

Some WordPress themes already support Yoast’s breadcrumbs. You can visit your website and click on single posts and pages to see if your theme displays breadcrumb navigation on the page.

If your theme does not automatically display breadcrumb navigation, then you will need to add a little code snippet to your WordPress theme.

Simply add this code in your theme or child theme‘s header.php file. You should place the code towards the end of the file.

<?php if ( function_exists('yoast_breadcrumb') ) 
{yoast_breadcrumb('<p id="breadcrumbs">','</p>');} ?>

That’s all you can now visit your website to see breadcrumb navigation in action.

We hope this article helped you display breadcrumb navigation links in WordPress. You may also want to see our list of 24 must have WordPress plugins for business websites.

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 Display Breadcrumb Navigation Links in WordPress appeared first on WPBeginner.