How to Highlight New Posts for Returning Visitors in WordPress

Did you ever marvel how standard websites spotlight new posts for returning guests? Clearly highlighting new posts to returning guests is a good way to lend a hand customers to find new content material and building up your pageviews. In this newsletter, we will be able to display you the way to spotlight new posts for returning guests in WordPress.

Why Highlight New Posts for Returning Visitors?

Returning guests are most often customers who like your content material and are available again having a look for extra. However, some of these customers handiest spend a couple of seconds, they usually go away in the event that they don’t to find the rest attention-grabbing.

By highlighting new content material, you’ll level consumer’s consideration to the most recent content material. This is not going to handiest will let you building up your pageviews, however it is going to additionally lend a hand customers to find new content material.

Method 1: Highlight New WordPress Posts with a Plugin

In this system, we will be able to be the usage of a plugin to spotlight new posts for returning customers. This manner is more straightforward to put in force, and we suggest it for rookies.

First factor you want to do is set up and turn on the Mark New Posts plugin. For extra main points, see our step-by-step information on how to set up a WordPress plugin.

Upon activation, you want to seek advice from Settings » Mark New Posts to arrange plugin.

Mark new posts settings

First you want to select marker placement. The plugin can display new publish marker earlier than the publish name, after the publish name, or each.

After that you want to select a marker kind. There are plenty of alternatives. By default the plugin will display a small symbol because the marker.

New post highlighted

You can select to display a circle, a customized symbol, ‘New’ textual content, or a flag.

Lastly, you want to make a choice when you need the marker to disappear. If you test the field subsequent to ‘Mark posts as learn handiest after opening’ choice, then plugin will stay appearing unread posts as new to your customers.

This generally is a bit worrying for your customers. We counsel leaving it unchecked in order that your customers are handiest notified about new posts since their final seek advice from.

Don’t disregard to click on at the save button to retailer your settings.

That’s all, the plugin will now spotlight new posts for returning customers along with your decided on marker kind.

Method 2: Highlight New Posts by means of Adding Code Manually

This manner calls for including code to your WordPress website. If you’re assured about including code snippets to your WordPress website, then you’ll do that manner.

As at all times, you’ll want to backup WordPress earlier than including code snippets to your website.

First factor you want to do is reproduction and paste this code in your theme’s purposes.php document or a site-specific plugin.

serve as wpb_lastvisit_the_title ( $name, $identity )   $_COOKIE['lastvisit'] == '' ) go back $name;
$lastvisit = $_COOKIE['lastvisit'];
$publish_date = get_post_time( 'U', true, $identity );
if ($publish_date > $lastvisit) $name .= '<span elegance="new-article">New</span>';
go back $name;

add_filter( 'the_title', 'wpb_lastvisit_the_title', 10, 2);
// Set the lastvisit cookie 

serve as wpb_lastvisit_set_cookie() {

if ( is_admin() ) go back;
$present = current_time( 'timestamp', 1);
setcookie( 'lastvisit', $present, time()+60+60*24*7, COOKIEPATH, COOKIE_DOMAIN );

add_action( 'init', 'wpb_lastvisit_set_cookie' );

This code appears to be like for a cookie known as lastvisit when a consumer arrives in your web page. If it does no longer to find the cookie, then it units the cookie with the present time.

If it unearths the cookie, then it provides ‘New’ to the name of the articles revealed since consumer’s final seek advice from.

Notice that there’s a new-article elegance in the <span> tag round ‘New’. You will use this elegance to taste the textual content the usage of CSS.

We used the next CSS for our demo. Simply reproduction and paste it in your theme or kid theme‘s stylesheet.

.new-article { 
background: #feffdd;
padding: 3px;
border: 1px forged #eeefd2;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
font-size: small;
font-weight: daring;

This is the way it regarded on our demo web page.

Highlighting new since last visited articles in WordPress

We hope this newsletter helped you spotlight new posts for returning guests in WordPress. Play round with the code, trade the highlighted textual content and CSS to meet your wishes.

You might also need to check out our information on how to display final visited posts to a consumer.

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

Recent Articles

4 Best Apps to Teach Children to Read and Write at Home

Writing and reading are the two most basic skills that are taught to a kid. Though basic...

The Top Fixes to Improve your WiFi Performance on an iPhone.

What could be worse than no wifi? The answer is simple; a bad wifi connection. There is nothing more annoying than a wifi...

The 4 Best DNS Softwares for Increased Safety and Speed

If you are someone who wants your internet to always be swift and safe. Switching your DNS Server will serve you pretty...

6 Ways To Learn Things Without Reading anything

The times are stressful, everyone wants to learn but it is just hard to focus. It is...

4 Best Password Managers to Make Use of in 2021

Are you someone who can’t keep track of all the passwords you have? Do you end up getting confused about the passwords...

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here