lundi 11 septembre 2017

How to display image randomly picked from Wordpress's page?

I would like to display one image at a time on my page, that is picked randomly from the images loaded in this page (from wordpress admin).

I am working on Wordpress, with my own theme and I have a front-page.php file where I have my function to load the content of my page.

I don't know how to add the random image function to this code.

my PHP code:

<?php get_header(); ?>
<div class="container">
  <?php if (have_posts()):  ?>
  <?php while(have_posts()): the_post(); ?>
  <div class="row">
    <div class="col-lg-7 col-md-10 col-sm-12 col-xs-12">
      <div id="home_page_content">
        <?php the_content(); ?>
      </div>
    </div>
  </div>
  <?php endwhile; ?>
  <?php endif; ?>
</div>



Aucun commentaire:

Enregistrer un commentaire