SHARE
TWEET

Untitled

a guest Sep 13th, 2017 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <form action="<?php echo esc_url( home_url( '/your_redirected_page_slug' ) ); ?>" method="GET" id="form1">
  2.     <?php  global $post;
  3.          //$post_slug=$post->post_name;
  4.  
  5.     ?>
  6.     <input id="myButton" type="submit" name="a" value="Download" class="single-download-button" />
  7.      <input type="hidden" name="appk" id="mkval" value="<?php echo get_the_ID(); ?>" />                                                  
  8.  </form>
  9.    
  10. <?php
  11. $id = $_GET['appk']; // get form data
  12. $popularpost = new WP_Query( array('post_type' => 'your_cusom_post_name',
  13.      'posts_per_page' => 9,
  14.      // 'meta_key' => 'wpb_post_views_count',
  15.      //'orderby' => 'meta_value_num',                              
  16.      'order' => 'DESC',
  17.      'p' => $id,
  18.       ) );
  19.  
  20.  
  21.     while ( $popularpost->have_posts() ) : $popularpost->the_post();
  22.     $id = get_the_ID();
  23.  
  24.     ?>
  25.  
  26.  
  27.     <!-- Your Code Function here -->
  28.  
  29. <?php
  30.     endwhile;
  31.     // Reset Post Data
  32.         wp_reset_postdata();
  33.     ?>
RAW Paste Data
Top