daily pastebin goal
33%
SHARE
TWEET

meta field in search result

a guest Jul 8th, 2013 193 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_filter('ajax_wpqsf_reoutput', 'customize_output', '', 2);
  2. function customize_output($results , $args){
  3.          // The Query
  4.                         $query = new WP_Query( $args );
  5.                 ob_start();     $results ='';
  6.                         // The Loop
  7.                 if ( $query->have_posts() ) {
  8.                         while ( $query->have_posts() ) {
  9.                                 $query->the_post();
  10.                                         echo get_post_meta($query->post->ID, 'your_meta_key', true );
  11.                                         echo  '<li>'.get_permalink().'</li>';
  12.                         }
  13.                  } else {
  14.                                          echo  'no post found';
  15.                                 }
  16.                                 /* Restore original Post Data */
  17.                                 wp_reset_postdata();
  18.  
  19.                 $results = ob_get_clean();             
  20.                         return $results;
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top