How to display the (already viewed) text in custom post query by using the cookie
function wpb_rand() {
$query = new WP_Query(array('post_type' => 'post', 'posts_per_page' =>'10', 'post_status' => 'publish', ) );
?>
<div class="ner-contai" >
<?php
if($query->have_posts()){
while($query->have_posts()) : $query->the_post() ;
$post_id = get_the_ID();
?>
<span id="div_<?php the_ID(); ?>">
//What code goes here to display (already viewed text)
</span>
<p class="postName"><?php the_title(); ?></p>
<a href="<?php the_permalink() ?>" class="button" target="_blank">Visit</span></a>
<?php
endwhile;
}else {
echo 'Sorry, no posts were found';
}
?>
</div>
<?php
}
add_shortcode('ramdom-post','wpb_rand');
]]>
Hello, instead of displaying articles, is it possible to pick custom post type?
Thanks!
When a user hits a link sometimes the plugin create a second link in the section “last viewed” that the visitor haven’t visited.
]]>Hi,
I get this message while using this plugin;
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
Kindly fix it.
]]>Hello,
Is there a way to show the recently viewed for users who are not logged in?
The Plugin is great, but it seems to only be working for users who are logged in.
Please advice,
Sam
I want that my widget to retrieve just pages, with possibility to exclude ID-s of specific pages. Appreciate some help, thanks.
]]>Hello,
I’m using this to call the plugin in my template:
<div id="recentlyviewed" class="clearfix">
<?php if (function_exists('zg_recently_viewed')): if (isset($_COOKIE["WP-LastViewedPosts"])) { ?>
<hr>
<h3>Recently Viewed:</h3>
<?php zg_recently_viewed(); ?>
<?php } endif; ?>
</div>
The problem is, once the cookie is set, it will show the conditional html above after the next page is viewed but there is nothing to show yet as the only last viewed post is the current page.
Once a user goes to the next page (the second page after the cookie is set), then there is a post to show.
I’ve tried to run a conditional check to see if there is a value in the second item in the cookie array but not having any luck.
In plain english:
Once the cookie is set, only show content if there is a value in the second item in the cookie.
Does that make sense? How can I do this?
Thanks.
]]>HI i am currently running an awpcp (another wordpress classifieds plugin) site with ads/listings, I would like to use your plugin to show a list of recently viewed ads instead of posts, is there a way of replacing the search for post ids with a search for ad ids? I’ve already added in the code you wrote for excluding certain pages, don’t know if that will affect it but thought you should know.
I am not an expert but getting more comfortable editing code so if you could let me know what sections of the code I would need to replace or add/remove it would be greatly appreciated. Thanks in advance.
I was having a problem with this plugin that it kept adding to the cookie a seemingly random post.
Thanks to this post https://www.ads-software.com/support/topic/wordpress-issues-with-firefox-when-setting-cookies?replies=2#post-4681617
the problem is firefox pre-loading the next post
more details here ->
]]>I read the previous issue with getting the thumbnail image to display but I cant seem to get it to work.
I wish to display the post title with the featured image displayed underneath? Please can someone share the code so I can add this in?
Many thanks
Dan
]]>So far I love this plugin but I use shortcodes in my title and access them with get_the_title() which has always worked. I have the title to shortcode enabled on my site. My problem is I cannot figure out where (if it is possible) to change the title output to do my shortcode. I tried this:
$zg_get_title = get_the_title($value+0);
and this:
echo "<a href=\"". get_permalink($value+0) . "\" title=\"". $zg_title_out->post_title . "\">". get_the_title($value+0) . "</a>\n";
but both give a sql error so I am missing something about the loop. I would love to see if this can be done.
Thanks!
https://www.ads-software.com/extend/plugins/last-viewed-posts/
]]>Plugin did not immediately cause this error, “Warning: Cannot modify header information – headers already sent by…” but eventually it did appear. Once the plugin was deactivated the problem went away.
I have removed this plugin from 2 if my 3 WordPress sites — I was just in development on the third site & had not installed it yet
Too bad — it worked fine EXCEPT for the above error.
https://www.ads-software.com/extend/plugins/last-viewed-posts/
]]>Hello, I was wondering why this plugin works in one of my sites, but it doesnt work in the second one??
both has same ver of werdpress
does anyone know why??
https://www.ads-software.com/extend/plugins/last-viewed-posts/
]]>Notice: Undefined index: path in \wp-content\plugins\last-viewed-posts\last_viewed_posts.php on line 83
How do fix this?
https://www.ads-software.com/extend/plugins/last-viewed-posts/
]]>Hi, thnx for writing this plugin!
Is it possible to exclude a specific page in the list of last viewed?
https://www.ads-software.com/extend/plugins/last-viewed-posts/
]]>Hello, I was wondering if someone could help me add the post thumbnail/image to this wonderful plugin…..
Thanks,
Ronnie
https://www.ads-software.com/extend/plugins/last-viewed-posts/
]]>