PrivatePost No Duplicates
-
Hello everyone, thanks for taking the time to read this issue.
<?php $query = "SELECT post_title, MONTH( post_date ) AS month , YEAR( post_date ) AS year, DAY( post_date ) AS day , id FROM $wpdb->posts WHERE post_status = 'publish' AND post_date <= now( ) and post_type = 'post' ORDER BY post_date DESC"; if ( $posts = $wpdb->get_results($query) ) {foreach ($posts as $post) { ?> <li><span class="archive-date"><?php echo date("F jS, Y",mktime(0, 0, 0, $post->month, $post->day, $post->year)) ?></span> <a href="<?php echo get_permalink($post->id)?>"><?php echo $post->post_title ?></a></li> <?php } } ?>
Here’s the run down of everything:
– My website is https://kristopherlouie.com, the afflicted page is https://kristopherlouie.com/archive
– I’m using PrivatePost to allow only registered users to view private entries
– I’m using the above code as my archive list.
– When you are not logged in, you cannot see any of the private entries on the main page or on the archive list.
PROBLEM: However, when you are logged in you can see the private entries (intentional) but you will also see doubles of each private entry when you view the archives.
I’ve tried a lot of loop hacks and editing the query = “” clause, but I can’t seem to get it to work.
Any feedback would be appreciated.
- The topic ‘PrivatePost No Duplicates’ is closed to new replies.