display (viewed) text in custom query
-
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');
- The topic ‘display (viewed) text in custom query’ is closed to new replies.