Have you ever wondered how popular sites highlight new items for returning visitors? 

Clearly highlighting new articles to returning visitors is a great way to help users find new content, but also to get more pageviews.

In this tutorial, we'll show you how to highlight new articles for returning visitors to your website. WordPress blog.

put new articles highlight

Why put new articles highlighted the return of visitors?

Regular visitors are usually the users who like your content and keep coming back for more. However, most of these users only spend a few seconds, and they leave if they don't find something of interest.

By highlighting new content, you can draw their attention to the most recent content. This will not only help you increase your page views, but it will also allow them to find new content.

1 method: Highlight articles with a plugin

In this method, we will be using a plugin to highlight new articles upon returning visitors. This method is easier to implement, and we recommend it for beginners.

The first thing you need to do is install and activate the plugin Mark New Posts. For more details, see our step-by-step guide to way to install a WordPress plugin.

After activating the plugin, you need to visit the location " Settings "Mark New Post" to configure the plugin.

marknewposts-settings

You must first choose the location of the distinctive sign. The plugin can display it before or after the title. After that you need to choose the type of the marker. Several choices are available to you. By default, the plugin allows you to display an image as a distinctive sign.

distinctive marker

You can choose to display a circle, a custom image, the text " New Or a flag.

Finally, you need to define when you want the marker to disappear. If you check the box " Mark articles as read only after opening Then they will be displayed as new until the user opens the items.

This can be a bit annoying for your users. We recommend that you leave this box unchecked, so that your users are only notified of new articles since their last visit.

Don't forget to save your settings. That's it, the plugin will now highlight new posts after returning visitors.

2 Method: Highlight New Items Manually

This method requires adding code to your WordPress Plugin. If you are a developer, this method will not be binding on you. As always, be sure to make a Backup WordPress before adding snippets.

The first thing you need to do is copy and paste this code into your WordPress Plugin.

function bpc_lastvisit_the_title ($ title, $ id) {if (! in_the_loop () || is_singular () || get_post_type ($ id) == 'page') return $ title; // if no cookie then just return the title if (! isset ($ _ COOKIE ['lastvisit']) || $ _COOKIE ['lastvisit'] == '') return $ title; $ lastvisit = $ _COOKIE ['lastvisit']; $ publish_date = get_post_time ('U', true, $ id); if ($ publish_date> $ lastvisit) $ title. = ' New '; return $ title; } add_filter ('the_title', 'wpb_lastvisit_the_title', 10, 2); // Set the lastvisit cookie function wpb_lastvisit_set_cookie () {if (is_admin ()) return; $ current = current_time ('timestamp', 1); setcookie ('lastvisit', $ current, time () + 60 + 60 * 24 * 7, COOKIEPATH, COOKIE_DOMAIN); } add_action ('init', 'bpc_lastvisit_set_cookie');

This code searches for a cookie when a regular visitor logs in. If it cannot find the cookie, it sets the cookie with the current time.

If it finds the cookie, it adds'New'(or the marker of your choice) on the titles of the articles published before the creation of the cookie.

Note that there is a class " new-article 'In the tag around the marker'New'. You can use this class to apply a custom style.

Here is an example of CSS code:

.new-article {background: #feffdd; Padding: 3px; Border: 1px solid #eeefd2; -webkit-border-radius: 5px; -moz-border-radius: 5px; Border-radius: 5px; margin-left: 5px; Font-size: small; Font-weight: bold; }

This is how it appeared on our site (the little “New” label).

Article wordpress demo marker

We hope this article has helped you highlight new articles for returning visitors. your blog. Feel free to share the article with your friends.