Show new posts outside wordpress
-
Hello, I have two WordPress installed on my server and I want to show the latest posts added to them on a webpage outside the WordPress directories, using include function. This is the code (pointing to “directory” 1 or 2 depending on what wordpress you want to call):
<?php require_once("directory/wp-config.php"); ?> <?php $my_query = new WP_Query('showposts=4'); while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID;?> <a href="<?php echo get_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a> <?php the_time('j \d\e F \d\e Y'); ?><br /> <?php endwhile; ?>
What I do is duplicate this code to try to show the new posts separatedly but the problem is that when you load the webpage, both codes shows the same posts. This is like the variables load with the first code and it is maintained on the second load of code. I hope to have explained it well.
Any ideas?
Thank you.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Show new posts outside wordpress’ is closed to new replies.