Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am looking for a way to list posts being viewed but I can't find anything online.

Is it even possible? I've seen some websites that have these loops, "What other readers are currently reading".

I'm using the following loop to list random set of videos

<?php      
      if ( is_home() ){
      $cat = get_query_var( 'cat' );
      query_posts(array('orderby' => 'rand', 'showposts' => 10, 'cat'=>$cat));
      }
      while (have_posts()) : the_post();
  ?>

How can I show posts being viewed? anyone

share|improve this question

1 Answer 1

I would suggest a way to implement this to be in the post template have a call that updates post meta with the current timestamp. Then you can show posts that have been viewed recently by querying meta data for all values within a certain time range ordered by that timestamp.

share|improve this answer
    
Is it possible to tell wordpress to update the timestamp value if a post has been accessed? –  Jose David Garcia Llanos Feb 22 '13 at 10:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.