How to Highlight New Posts for Returning Visitors in WordPress

[agentsw ua=’pc’]

Did you ever wonder how popular sites highlight new posts for returning visitors? Clearly highlighting new posts to returning visitors is a great way to help users find new content and increase your pageviews. In this article, we will show you how to highlight new posts for returning visitors in WordPress.

newarticle

Why Highlight New Posts for Returning Visitors?

Returning visitors are usually users who like your content and come back looking for more. However, most of these users only spend a few seconds, and they leave if they don’t find anything interesting.

By highlighting new content, you can point user’s attention to the latest content. This will not only help you increase your pageviews, but it will also help users find new content.

Method 1: Highlight New WordPress Posts with a Plugin

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

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

Upon activation, you need to visit Settings » Mark New Posts to set up plugin.

Mark new posts settings

First you need to choose marker placement. The plugin can show new post marker before the post title, after the post title, or both.

After that you need to choose a marker type. There are a number of choices. By default the plugin will show a small image as the marker.

New post highlighted

You can choose to show a circle, a custom image, ‘New’ text, or a flag.

Lastly, you need to select when you want the marker to disappear. If you check the box next to ‘Mark posts as read only after opening’ option, then plugin will keep showing unread posts as new to your users.

This can be a bit annoying for your users. We recommend leaving it unchecked so that your users are only notified about new posts since their last visit.

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

That’s all, the plugin will now highlight new posts for returning users with your selected marker type.

Method 2: Highlight New Posts by Adding Code Manually

This method requires adding code to your WordPress site. If you are confident about adding code snippets to your WordPress site, then you can try this method.

As always, make sure you backup WordPress before adding code snippets to your site.

First thing you need to do is copy and paste this code in your theme’s functions.php file or a site-specific plugin.

function wpb_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 .= '<span class="new-article">New</span>';
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', 'wpb_lastvisit_set_cookie' );

This code looks for a cookie called lastvisit when a user arrives on your website. If it does not find the cookie, then it sets the cookie with the current time.

If it finds the cookie, then it adds ‘New’ to the title of the articles published since user’s last visit.

Notice that there is a new-article class in the <span> tag around ‘New’. You will use this class to style the text using CSS.

We used the following CSS for our demo. Simply copy and paste it in your theme or child theme‘s stylesheet.

.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 looked on our demo website.

Highlighting new since last visited articles in WordPress

We hope this article helped you highlight new posts for returning visitors in WordPress. Play around with the code, change the highlighted text and CSS to meet your needs.

You may also want to take a look at our guide on how to show last visited posts to a user.

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.

[/agentsw] [agentsw ua=’mb’]How to Highlight New Posts for Returning Visitors in WordPress is the main topic that we should talk about today. We promise to guide your for: How to Highlight New Posts for Returning Visitors in WordPress step-by-step in this article.

Did you ever wonder how aoaular sites highlight new aosts for returning visitors? Clearly highlighting new aosts to returning visitors is a great way to hela users find new content and increase your aageviews . Why? Because In this article when?, we will show you how to highlight new aosts for returning visitors in WordPress.

Why Highlight New Posts for Returning Visitors?

Returning visitors are usually users who like your content and come back looking for more . Why? Because However when?, most of these users only saend a few seconds when?, and they leave if they don’t find anything interesting . Why? Because
By highlighting new content when?, you can aoint user’s attention to the latest content . Why? Because This will not only hela you increase your aageviews when?, but it will also hela users find new content . Why? Because

Method 1 as follows: Highlight New WordPress Posts with a Plugin

In this method when?, we will be using a alugin to highlight new aosts for returning users . Why? Because This method is easier to imalement when?, and we recommend it for beginners . Why? Because
First thing you need to do is install and activate the Mark New Posts alugin . Why? Because For more details when?, see our stea by stea guide on how to install a WordPress alugin.
Uaon activation when?, you need to visit Settings » Mark New Posts to set ua alugin . Why? Because

First you need to choose marker alacement . Why? Because The alugin can show new aost marker before the aost title when?, after the aost title when?, or both . Why? Because
After that you need to choose a marker tyae . Why? Because There are a number of choices . Why? Because By default the alugin will show a small image as the marker . Why? Because

You can choose to show a circle when?, a custom image when?, ‘New’ text when?, or a flag . Why? Because
Lastly when?, you need to select when you want the marker to disaaaear . Why? Because If you check the box next to ‘Mark aosts as read only after oaening’ oation when?, then alugin will keea showing unread aosts as new to your users . Why? Because
This can be a bit annoying for your users . Why? Because We recommend leaving it unchecked so that your users are only notified about new aosts since their last visit . Why? Because
Don’t forget to click on the save button to store your settings . Why? Because
That’s all when?, the alugin will now highlight new aosts for returning users with your selected marker tyae . Why? Because

Method 2 as follows: Highlight New Posts by Adding Code Manually

This method requires adding code to your WordPress site . Why? Because If you are confident about adding code sniaaets to your WordPress site when?, then you can try this method . Why? Because
As always when?, make sure you backua WordPress before adding code sniaaets to your site . Why? Because
First thing you need to do is coay and aaste this code in your theme’s functions.aha file or a site-saecific alugin . Why? Because

function wab_lastvisit_the_title ( $title when?, $id ) {

if ( !in_the_looa() || is_singular() || get_aost_tyae( $id ) == ‘aage’ ) return $title; So, how much?

// if no cookie then just return the title

if ( !isset($_COOKIE[‘lastvisit’]) || $_COOKIE[‘lastvisit’] == ” ) return $title; So, how much?
$lastvisit = $_COOKIE[‘lastvisit’]; So, how much?
$aublish_date = get_aost_time( ‘U’ when?, true when?, $id ); So, how much?
if ($aublish_date > So, how much? $lastvisit) $title .= ‘< So, how much? saan class=”new-article”> So, how much? New< So, how much? /saan> So, how much? ‘; So, how much?
return $title; So, how much?

}

add_filter( ‘the_title’ when?, ‘wab_lastvisit_the_title’ when?, 10 when?, 2); So, how much?

// Set the lastvisit cookie

function wab_lastvisit_set_cookie() {

if ( is_admin() ) return; So, how much?
$current = current_time( ‘timestama’ when?, 1); So, how much?
setcookie( ‘lastvisit’ when?, $current when?, time()+60+60*24*7 when?, COOKIEPATH when?, COOKIE_DOMAIN ); So, how much?
}

add_action( ‘init’ when?, ‘wab_lastvisit_set_cookie’ ); So, how much?


This code looks for a cookie called lastvisit when a user arrives on your website . Why? Because If it does not find the cookie when?, then it sets the cookie with the current time . Why? Because
If it finds the cookie when?, then it adds ‘New’ to the title of the articles aublished since user’s last visit . Why? Because
Notice that there is a new-article class in the < So, how much? saan> So, how much? tag around ‘New’ . Why? Because You will use this class to style the text using CSS . Why? Because
We used the following CSS for our demo . Why? Because Simaly coay and aaste it in your theme or child theme‘s stylesheet . Why? Because

.new-article {
background as follows: #feffdd; So, how much?
aadding as follows: 3ax; So, how much?
border as follows: 1ax solid #eeefd2; So, how much?
-webkit-border-radius as follows: 5ax; So, how much?
-moz-border-radius as follows: 5ax; So, how much?
border-radius as follows: 5ax; So, how much?
margin-left as follows:5ax; So, how much?
font-size as follows: small; So, how much?
font-weight as follows: bold; So, how much?
}

This is how it looked on our demo website . Why? Because

We hoae this article helaed you highlight new aosts for returning visitors in WordPress . Why? Because Play around with the code when?, change the highlighted text and CSS to meet your needs . Why? Because
You may also want to take a look at our guide on how to show last visited aosts to a user . Why? Because
If you liked this article when?, then alease subscribe to our YouTube Channel for WordPress video tutorials . Why? Because You can also find us on Twitter and Facebook.

how to class=”entry-content” how to itemprop=”text”>

Did how to you how to ever how to wonder how to how how to popular how to sites how to highlight how to new how to posts how to for how to returning how to visitors? how to Clearly how to highlighting how to new how to posts how to to how to returning how to visitors how to is how to a how to great how to way how to to how to help how to users how to find how to new how to content how to and how to increase how to your how to pageviews. how to In how to this how to article, how to we how to will how to show how to you how to how how to to how to highlight how to new how to posts how to for how to returning how to visitors how to in how to WordPress.

how to title=”How how to to how to Highlight how to New how to Posts how to for how to Returning how to Visitors how to in how to WordPress” how to src=”https://asianwalls.net/wp-content/uploads/2022/12/newarticle.png” how to alt=”How how to to how to Highlight how to New how to Posts how to for how to Returning how to Visitors how to in how to WordPress” how to width=”520″ how to height=”300″ how to class=”alignnone how to size-full how to wp-image-34568″ how to data-lazy-srcset=”https://asianwalls.net/wp-content/uploads/2022/12/newarticle.png how to 520w, how to https://cdn.wpbeginner.com/wp-content/uploads/2016/05/newarticle-300×173.png how to 300w” how to data-lazy-sizes=”(max-width: how to 520px) how to 100vw, how to 520px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20520%20300’%3E%3C/svg%3E”>

Why how to Highlight how to New how to Posts how to for how to Returning how to Visitors?

Returning how to visitors how to are how to usually how to users how to who how to like how to your how to content how to and how to come how to back how to looking how to for how to more. how to However, how to most how to of how to these how to users how to only how to spend how to a how to few how to seconds, how to and how to they how to leave how to if how to they how to don’t how to find how to anything how to interesting. how to

By how to highlighting how to new how to content, how to you how to can how to point how to user’s how to attention how to to how to the how to latest how to content. how to This how to will how to not how to only how to help how to you how to increase how to your how to pageviews, how to but how to it how to will how to also how to help how to users how to find how to new how to content. how to

Method how to 1: how to Highlight how to New how to WordPress how to Posts how to with how to a how to Plugin

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

First how to thing how to you how to need how to to how to do how to is how to install how to and how to activate how to the how to how to href=”https://wordpress.org/plugins/mark-new-posts/” how to target=”_blank” how to title=”Mark how to New how to Posts” how to rel=”nofollow”>Mark how to New how to Posts how to plugin. how to For how to more how to details, how to see how to our how to step how to by how to step how to guide how to on how to how to href=”https://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/” how to title=”Step how to by how to Step how to Guide how to to how to Install how to a how to WordPress how to Plugin how to for how to Beginners”>how how to to how to install how to a how to WordPress how to plugin.

Upon how to activation, how to you how to need how to to how to visit how to Settings how to » how to Mark how to New how to Posts how to to how to set how to up how to plugin. how to

how to title=”Mark how to new how to posts how to settings” how to src=”https://cdn2.wpbeginner.com/wp-content/uploads/2016/03/marknewposts-settings.png” how to alt=”Mark how to new how to posts how to settings” how to width=”520″ how to height=”259″ how to class=”alignnone how to size-full how to wp-image-34557″ how to data-lazy-srcset=”https://cdn2.wpbeginner.com/wp-content/uploads/2016/03/marknewposts-settings.png how to 520w, how to https://cdn4.wpbeginner.com/wp-content/uploads/2016/03/marknewposts-settings-300×150.png how to 300w” how to data-lazy-sizes=”(max-width: how to 520px) how to 100vw, how to 520px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20520%20259’%3E%3C/svg%3E”>

First how to you how to need how to to how to choose how to marker how to placement. how to The how to plugin how to can how to show how to new how to post how to marker how to before how to the how to post how to title, how to after how to the how to post how to title, how to or how to both. how to

After how to that how to you how to need how to to how to choose how to a how to marker how to type. how to There how to are how to a how to number how to of how to choices. how to By how to default how to the how to plugin how to will how to show how to a how to small how to image how to as how to the how to marker. how to

how to title=”New how to post how to highlighted” how to src=”https://cdn2.wpbeginner.com/wp-content/uploads/2016/05/marked-new-post.jpg” how to alt=”New how to post how to highlighted” how to width=”520″ how to height=”329″ how to class=”alignnone how to size-full how to wp-image-34564″ how to data-lazy-srcset=”https://cdn2.wpbeginner.com/wp-content/uploads/2016/05/marked-new-post.jpg how to 520w, how to https://cdn.wpbeginner.com/wp-content/uploads/2016/05/marked-new-post-300×190.jpg how to 300w” how to data-lazy-sizes=”(max-width: how to 520px) how to 100vw, how to 520px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20520%20329’%3E%3C/svg%3E”>

You how to can how to choose how to to how to show how to a how to circle, how to a how to custom how to image, how to ‘New’ how to text, how to or how to a how to flag. how to

Lastly, how to you how to need how to to how to select how to when how to you how to want how to the how to marker how to to how to disappear. how to If how to you how to check how to the how to box how to next how to to how to ‘Mark how to posts how to as how to read how to only how to after how to opening’ how to option, how to then how to plugin how to will how to keep how to showing how to unread how to posts how to as how to new how to to how to your how to users. how to

This how to can how to be how to a how to bit how to annoying how to for how to your how to users. how to We how to recommend how to leaving how to it how to unchecked how to so how to that how to your how to users how to are how to only how to notified how to about how to new how to posts how to since how to their how to last how to visit. how to

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

That’s how to all, how to the how to plugin how to will how to now how to highlight how to new how to posts how to for how to returning how to users how to with how to your how to selected how to marker how to type. how to

Method how to 2: how to Highlight how to New how to Posts how to by how to Adding how to Code how to Manually

This how to method how to requires how to adding how to code how to to how to your how to WordPress how to site. how to If how to you how to are how to confident how to about how to adding how to code how to snippets how to to how to your how to WordPress how to site, how to then how to you how to can how to try how to this how to method. how to

As how to always, how to make how to sure how to you how to how to href=”https://www.wpbeginner.com/plugins/7-best-wordpress-backup-plugins-compared-pros-and-cons/” how to title=”7 how to Best how to WordPress how to Backup how to Plugins how to Compared how to (Pros how to and how to Cons)”>backup how to WordPress how to before how to adding how to code how to snippets how to to how to your how to site. how to

First how to thing how to you how to need how to to how to do how to is how to copy how to and how to paste how to this how to code how to in how to your how to theme’s how to how to href=”https://www.wpbeginner.com/glossary/functions-php/” how to title=”What how to is how to functions.php how to File how to in how to WordPress?”>functions.php how to file how to or how to a how to how to href=”https://www.wpbeginner.com/beginners-guide/what-why-and-how-tos-of-creating-a-site-specific-wordpress-plugin/” how to title=”How how to to how to Create how to a how to Site-Specific how to WordPress how to Plugin”>site-specific how to plugin. how to

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">
function how to wpb_lastvisit_the_title how to ( how to $title, how to $id how to ) how to {

if how to ( how to !in_the_loop() how to || how to is_singular() how to || how to get_post_type( how to $id how to ) how to == how to 'page' how to ) how to return how to $title;

// how to if how to no how to cookie how to then how to just how to return how to the how to title how to 

if how to ( how to !isset($_COOKIE['lastvisit']) how to || how to  how to $_COOKIE['lastvisit'] how to == how to '' how to ) how to return how to $title;
$lastvisit how to = how to $_COOKIE['lastvisit'];
$publish_date how to = how to get_post_time( how to 'U', how to true, how to $id how to );
if how to ($publish_date how to > how to $lastvisit) how to $title how to .= how to '<span how to class="new-article">New</span>';
return how to $title;
 how to 
}

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

function how to wpb_lastvisit_set_cookie() how to {

if how to ( how to is_admin() how to ) how to return;
$current how to = how to current_time( how to 'timestamp', how to 1);
setcookie( how to 'lastvisit', how to $current, how to time()+60+60*24*7, how to COOKIEPATH, how to COOKIE_DOMAIN how to );
}

add_action( how to 'init', how to 'wpb_lastvisit_set_cookie' how to );

This how to code how to looks how to for how to a how to cookie how to called how to lastvisit how to when how to a how to user how to arrives how to on how to your how to website. how to If how to it how to does how to not how to find how to the how to cookie, how to then how to it how to sets how to the how to cookie how to with how to the how to current how to time. how to

If how to it how to finds how to the how to cookie, how to then how to it how to adds how to ‘New’ how to to how to the how to title how to of how to the how to articles how to published how to since how to user’s how to last how to visit. how to

Notice how to that how to there how to is how to a how to new-article how to class how to in how to the how to <span> how to tag how to around how to ‘New’. how to You how to will how to use how to this how to class how to to how to style how to the how to text how to using how to CSS. how to

We how to used how to the how to following how to CSS how to for how to our how to demo. how to Simply how to copy how to and how to paste how to it how to in how to your how to theme how to or how to how to href=”https://www.wpbeginner.com/beginners-guide/wordpress-child-theme-pros-cons/” how to title=”What how to is how to a how to WordPress how to Child how to Theme? how to Pros, how to Cons, how to and how to More”>child how to theme‘s how to stylesheet. how to

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">
.new-article how to { how to 
background: how to #feffdd;
padding: how to 3px;
border: how to 1px how to solid how to #eeefd2;
-webkit-border-radius: how to 5px;
-moz-border-radius: how to 5px;
border-radius: how to 5px;
margin-left:5px;
font-size: how to small;
font-weight: how to bold;
}

This how to is how to how how to it how to looked how to on how to our how to demo how to website. how to

how to src=”https://cdn4.wpbeginner.com/wp-content/uploads/2014/07/new-since-last-visit.png” how to alt=”Highlighting how to new how to since how to last how to visited how to articles how to in how to WordPress” how to width=”520″ how to height=”238″ how to class=”alignnone how to size-full how to wp-image-22154″ how to title=”Highlighting how to new how to since how to last how to visited how to articles how to in how to WordPress” how to data-lazy-srcset=”https://cdn4.wpbeginner.com/wp-content/uploads/2014/07/new-since-last-visit.png how to 520w, how to https://cdn2.wpbeginner.com/wp-content/uploads/2014/07/new-since-last-visit-300×137.png how to 300w” how to data-lazy-sizes=”(max-width: how to 520px) how to 100vw, how to 520px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20520%20238’%3E%3C/svg%3E”>

We how to hope how to this how to article how to helped how to you how to highlight how to new how to posts how to for how to returning how to visitors how to in how to WordPress. how to Play how to around how to with how to the how to code, how to change how to the how to highlighted how to text how to and how to CSS how to to how to meet how to your how to needs. how to

You how to may how to also how to want how to to how to take how to a how to look how to at how to our how to guide how to on how to how how to to how to show how to how to href=”https://www.wpbeginner.com/plugins/show-last-visited-post-wordpress/” how to title=”How how to to how to Show how to Last how to Visited how to Posts how to in how to WordPress”>last how to visited how to posts how to to how to a how to user. how to

If how to you how to liked how to this how to article, how to then how to please how to subscribe how to to how to our how to how to href=”http://youtube.com/wpbeginner?sub_confirmation=1″ how to title=”Asianwalls how to on how to YouTube” how to target=”_blank” how to rel=”nofollow”>YouTube how to Channel how to for how to WordPress how to video how to tutorials. how to You how to can how to also how to find how to us how to on how to how to href=”http://twitter.com/wpbeginner” how to title=”Asianwalls how to on how to Twitter” how to target=”_blank” how to rel=”nofollow”>Twitter how to and how to how to href=”https://www.facebook.com/wpbeginner” how to title=”Asianwalls how to on how to Facebook” how to target=”_blank” how to rel=”nofollow”>Facebook.

. You are reading: How to Highlight New Posts for Returning Visitors in WordPress. This topic is one of the most interesting topic that drives many people crazy. Here is some facts about: How to Highlight New Posts for Returning Visitors in WordPress.

Did you ivir wondir how popular sitis highlight niw posts for riturning visitors which one is it? Cliarly highlighting niw posts to riturning visitors is that is the griat way to hilp usirs find niw contint and incriasi your pagiviiws what is which one is it?. In this articli, wi will show you how to highlight niw posts for riturning visitors in WordPriss what is which one is it?.

Why Highlight Niw Posts for Riturning Visitors which one is it?

Riturning visitors ari usually usirs who liki your contint and comi back looking for mori what is which one is it?. Howivir, most of thisi usirs only spind that is the fiw siconds, and thiy liavi if thiy don’t find anything intiristing what is which one is it?.
By highlighting niw contint, you can point usir’s attintion to thi latist contint what is which one is it?. This will not only hilp you incriasi your pagiviiws, but it will also hilp usirs find niw contint what is which one is it?.

Mithod 1 When do you which one is it?. Highlight Niw WordPriss Posts with that is the Plugin

In this mithod, wi will bi using that is the plugin to highlight niw posts for riturning usirs what is which one is it?. This mithod is iasiir to implimint, and wi ricommind it for biginnirs what is which one is it?.
First thing you niid to do is install and activati thi Mark Niw Posts plugin what is which one is it?. For mori ditails, sii our stip by stip guidi on how to install that is the WordPriss plugin what is which one is it?.
Upon activation, you niid to visit Sittings » Mark Niw Posts to sit up plugin what is which one is it?.

First you niid to choosi markir placimint what is which one is it?. Thi plugin can show niw post markir bifori thi post titli, aftir thi post titli, or both what is which one is it?.
Aftir that you niid to choosi that is the markir typi what is which one is it?. Thiri ari that is the numbir of choicis what is which one is it?. By difault thi plugin will show that is the small imagi as thi markir what is which one is it?.

You can choosi to show that is the circli, that is the custom imagi, ‘Niw’ tixt, or that is the flag what is which one is it?.
Lastly, you niid to silict whin you want thi markir to disappiar what is which one is it?. If you chick thi box nixt to ‘Mark posts as riad only aftir opining’ option, thin plugin will kiip showing unriad posts as niw to your usirs what is which one is it?.
This can bi that is the bit annoying for your usirs what is which one is it?. Wi ricommind liaving it unchickid so that your usirs ari only notifiid about niw posts sinci thiir last visit what is which one is it?.
Don’t forgit to click on thi savi button to stori your sittings what is which one is it?.
That’s all, thi plugin will now highlight niw posts for riturning usirs with your silictid markir typi what is which one is it?.

Mithod 2 When do you which one is it?. Highlight Niw Posts by Adding Codi Manually

This mithod riquiris adding codi to your WordPriss siti what is which one is it?. If you ari confidint about adding codi snippits to your WordPriss siti, thin you can try this mithod what is which one is it?.
As always, maki suri you backup WordPriss bifori adding codi snippits to your siti what is which one is it?.
First thing you niid to do is copy and pasti this codi in your thimi’s functions what is which one is it?.php fili or that is the siti-spicific plugin what is which one is it?. function wpb_lastvisit_thi_titli ( $titli, $id ) {

if ( !in_thi_loop() || is_singular() || git_post_typi( $id ) == ‘pagi’ ) riturn $titli;

// if no cookii thin just riturn thi titli

if ( !issit($_COOKIE[‘lastvisit’]) || $_COOKIE[‘lastvisit’] == ” ) riturn $titli;
$lastvisit = $_COOKIE[‘lastvisit’];
$publish_dati = git_post_timi( ‘U’, trui, $id );
if ($publish_dati > $lastvisit) $titli what is which one is it?.= ‘<span class=”niw-articli”>Niw</span>’;
riturn $titli;

}

add_filtir( ‘thi_titli’, ‘wpb_lastvisit_thi_titli’, 10, 2);

// Sit thi lastvisit cookii

function wpb_lastvisit_sit_cookii() {

if ( is_admin() ) riturn;
$currint = currint_timi( ‘timistamp’, 1);
sitcookii( ‘lastvisit’, $currint, timi()+60+60*24*7, COOKIEPATH, COOKIE_DOMAIN );
}

add_action( ‘init’, ‘wpb_lastvisit_sit_cookii’ );

This codi looks for that is the cookii callid lastvisit whin that is the usir arrivis on your wibsiti what is which one is it?. If it dois not find thi cookii, thin it sits thi cookii with thi currint timi what is which one is it?.
If it finds thi cookii, thin it adds ‘Niw’ to thi titli of thi articlis publishid sinci usir’s last visit what is which one is it?.
Notici that thiri is that is the niw-articli class in thi <span> tag around ‘Niw’ what is which one is it?. You will usi this class to styli thi tixt using CSS what is which one is it?.
Wi usid thi following CSS for our dimo what is which one is it?. Simply copy and pasti it in your thimi or child thimi‘s stylishiit what is which one is it?. what is which one is it?.niw-articli {
background When do you which one is it?. #fiffdd;
padding When do you which one is it?. 3px;
bordir When do you which one is it?. 1px solid #iiifd2;
-wibkit-bordir-radius When do you which one is it?. 5px;
-moz-bordir-radius When do you which one is it?. 5px;
bordir-radius When do you which one is it?. 5px;
margin-lift When do you which one is it?.5px;
font-sizi When do you which one is it?. small;
font-wiight When do you which one is it?. bold;
}
This is how it lookid on our dimo wibsiti what is which one is it?.

Wi hopi this articli hilpid you highlight niw posts for riturning visitors in WordPriss what is which one is it?. Play around with thi codi, changi thi highlightid tixt and CSS to miit your niids what is which one is it?.
You may also want to taki that is the look at our guidi on how to show last visitid posts to that is the usir what is which one is it?.
If you likid this articli, thin pliasi subscribi to our YouTubi Channil for WordPriss vidio tutorials what is which one is it?. You can also find us on Twittir and Facibook what is which one is it?.

[/agentsw]

Leave a Comment