How to show blog posts changing every time after refreshing the page in non-wordpress website?

I have made a page in non-wordpress website which is showing the post from blog of wordpress website, it is working properly. I have added some PHP code in my page. Now I want that every time I refresh the page it will show different different post every time.

  define('WP_USE_THEMES', false);

<ul style="margin-top:0px">

<?php while (have_posts()): the_post(); ?>
 <li style="border: 1px solid #edf4fc;margin-bottom:30px">
<div class="img-hover-zoom">
  <a target="_blank" href="<?php the_permalink(); ?>"><p>
    if ( has_post_thumbnail() ) {
 <div class="content">
 <h4 style="font-size:18px;font-weight:500;"><?php the_title(); ?></h4>


<?php endwhile; ?>

Whatever is this doing?

Showing post from blog.

Modify the query to show random posts.

Yes it is working now…

1 Like