How to display admin side images on client side in

2019-09-04 23:31发布

问题:

I am creating a WordPress plugin and I ask user to insert some images on the settings page of the plugin on admin side. Now when a shortcode is inserted in the post, I want to display those images on the post.

Actually, I am creating a slideshow of these images, so I want to display the slideshow. The slideshow is being previewed on the admin side and the same should be shown on the post when the shortcode is inserted.

<script type="text/javascript">
   $(document).ready(function() {

      $('#sortable').sortable();
      $(btn_refresh).click(function(){

        document.getElementById('is1').style.display="block";
        document.getElementById('is2').style.display="block";
        document.getElementById('is3').style.display="block";

        var itemOrder = $('#sortable').sortable("toArray")

        document.getElementById("is1").src=document.getElementById(itemOrder[0]).src;
        document.getElementById("is2").src=document.getElementById(itemOrder[1]).src;
        document.getElementById("is3").src=document.getElementById(itemOrder[2]).src

        w3.slideshow(".pics", 1100);
  });
</script>

<?php 
  function slideshow_fun(){

   }
   add_shortcode('slideshow_shortcode','slideshow_fun'); 
  ?>

Now what should I write in the PHP function to display the slideshow? By the way, is1, is2, is3 are image tag ids that are previously defined on the same page. And this is a PHP file.