Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author TC.K

    (@wp_dummy)

    Well, you need to customize it by your self.
    First you need to use <a href="http://9-sec.com/2014/01/ultimate-wp-query-search-filter/">uwpqsf_result_tempt</a> to customize the ajax searched result.
    You can then use regular expressions (or str_replace) to add the hight light css into the excerpt.

    Thread Starter sfk

    (@sfk)

    I try this code before. I added to functions.php and later add to ultimate-wpqsf.php… and outcome only list of links and nothing else. I miss something?

    Plugin Author TC.K

    (@wp_dummy)

    Show me your codes.
    Normally you wouldn’t need to edit the plugin file.

    Thread Starter sfk

    (@sfk)

    This code bellow I add to functions.php:

    add_filter(‘uwpqsf_result_tempt’, ‘customize_output’, ”, 4);
    function customize_output($results , $arg, $id, $getdata ){
    // The Query
    $apiclass = new uwpqsfprocess();
    $query = new WP_Query( $arg );
    ob_start(); $result = ”;
    // The Loop

    if ( $query->have_posts() ) {
    while ( $query->have_posts() ) {
    $query->the_post();global $post;
    echo ‘

    • ‘.get_permalink().’
    • ‘;
      }
      echo $apiclass->ajax_pagination($arg[‘paged’],$query->max_num_pages, 4, $id, $getdata);
      } else {
      echo ‘no post found’;
      }
      /* Restore original Post Data */
      wp_reset_postdata();

      $results = ob_get_clean();
      return $results;
      }

    Thread Starter sfk

    (@sfk)

    add_filter('uwpqsf_result_tempt', 'customize_output', '', 4);
    function customize_output($results , $arg, $id, $getdata ){
    	 // The Query
                $apiclass = new uwpqsfprocess();
                 $query = new WP_Query( $arg );
    		ob_start();	$result = '';
    			// The Loop
    
    		if ( $query->have_posts() ) {
    			while ( $query->have_posts() ) {
    				$query->the_post();global $post;
                                    echo  '<li>'.get_permalink().'</li>';
    			}
                            echo  $apiclass->ajax_pagination($arg['paged'],$query->max_num_pages, 4, $id, $getdata);
    		 } else {
    					 echo  'no post found';
    				}
    				/* Restore original Post Data */
    				wp_reset_postdata();
    
    		$results = ob_get_clean();
    			return $results;
    }
    Plugin Author TC.K

    (@wp_dummy)

    The codes only an example of how you can customize the result. Since it is only permalink, title, in the while loop, that’s why you only see them. All you need is customize the while loop. Put some content in their such as content, custom meta fields etc. It is depends on you what you want to put. Also don’t forget the css class and html as well.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Highlight search terms’ is closed to new replies.