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

    (@wp_dummy)

    Yes, it is possible, Look for the ajax_wpqsf_reoutput() filter hook.

    Thread Starter Aldo

    (@ab_lu)

    How can I customize the pagination, any hook for this?

    Plugin Author TC.K

    (@wp_dummy)

    Yes,
    There is a filter ajwpqsf_pagination for this, please goto /classes/ajwpqsf-misc-class.php in function ajax_pagination for how to use it. Basically you are only allowed to change the design of the pagination, other thing have to be changed carefully because some of the attribute is used for javascript ajax called, eg. <a id=”…. the id is use for the passing page to ajax call.

    Thread Starter Aldo

    (@ab_lu)

    But how do I use it in combination with ajax_wpqsf_reoutput()?
    Because the pagination is not showed at all.

    I have a couple of questions around this discussion.

    Am I right in thinking that using the ajax_wpqsf_reoutput() filter hook will replace the query as well as the layout?

    Is there a way to just change the layout without changing the query argument?

    Cheers,

    Carl

    Plugin Author TC.K

    (@wp_dummy)

    @aldo,
    You will need to call the function again when you combine with ajax_wpqsf_reoutput() filter. Eg.

    $apiclass = new ajaxwpqsfclass();
    //and before end while loop:
    $apiclass->ajax_pagination($pagenumber,$query->max_num_pages, 4, $id);

    @mrcarllister,
    Sure you can,just don’t change anything on the argument, but change the layout on your result loop.

    Thread Starter Aldo

    (@ab_lu)

    Do I call the function in the customize_output filter?

    Plugin Author TC.K

    (@wp_dummy)

    Yes, in your customize output filter.

    @tc.K,

    I’m not sure what you mean (I’m not that experienced with hooks).

    Basically, I’ve put the hook into a function like so

    add_action ( 'ajax_wpqsf_reoutput', 'wpqsf_reoutput');
    
    function wpqsf_reoutput($results, $arg) {
    $html = '';
    
    	$html .= '<article><header class="entry-header">'.get_the_post_thumbnail().'';
    	$html .= '<h1 class="entry-title"><a href="'.get_permalink().'" rel="bookmark">'.get_the_title().'</a></h1>';
    	$html .= '</header>';
    	$html .= '<div class="entry-summary">'.get_the_excerpt().'</div></article>';
    
    return $html;
    }

    However, I seem to only be getting the last result when it’s displayed – I’ve tried foreach loop but to no joy.

    Any help would be great!

    Cheers,

    Plugin Author TC.K

    (@wp_dummy)

    @mrcarllister,
    You did not pass the $arg in the wp_query class.
    To use it, eg:

    add_filter('ajax_wpqsf_reoutput','wpqsf_reoutput','',2);
    function ajax_result($result, $arg ){
    		   $apiclass = new ajaxwpqsfclass();
    		  // The Query
    			$query = new WP_Query( $arg );
    			$html ='';
    			// The Loop
    		if ( $query->have_posts() ) {
    			$html .= '<h1>'.__('Search Results :', 'AjWPQSF' ).'</h1>';
    			while ( $query->have_posts() ) { $query->the_post();
    //here where you customize your layout					$html .= '<article><header class="entry-header">'.get_the_post_thumbnail().'';
    					$html .= '<h1 class="entry-title"><a href="'.get_permalink().'" rel="bookmark">'.get_the_title().'</a></h1>';
    					$html .= '</header>';
    					$html .= '<div class="entry-summary">'.get_the_excerpt().'</div></article>';
    
    			}
    
    			$html .= $apiclass->ajax_pagination($pagenumber,$query->max_num_pages, 4, $id);
    		 } else {
    					$html .= __( 'Nothing Found', 'AjWPQSF' );
    				}
    				/* Restore original Post Data */
    				wp_reset_postdata();
    
    			return $html;
    
    	   }

    Thread Starter Aldo

    (@ab_lu)

    @tc.K,

    If i place
    $apiclass->ajax_pagination($pagenumber,$query->max_num_pages, 4, $id);
    before the end while loop I get the pagination on each entry.

    When I place it outside, I get the pagination, but clicking on a number does not change the page. It loads, but no change.

    EDIT: Pagination changes, but the class “pagicurrent” remains at the first page.

    Yeah I’m getting the same pagination issue as @aldo.

    Pagination changes, but the class “pagicurrent” remains at the first page.

    Plugin Author TC.K

    (@wp_dummy)

    Oh…try to replace the $pagenumber on the ajax_pagination() with $arg[‘paged’].

    Thread Starter Aldo

    (@ab_lu)

    Still not changing the class “pagicurrent”

    Worked for me!

    @aldo your code should look something like this:

    add_filter('ajax_wpqsf_reoutput','wpqsf_reoutput','',2);
    
    function wpqsf_reoutput($result, $arg ){
    		   $apiclass = new ajaxwpqsfclass();
    		  // The Query
    			$query = new WP_Query( $arg );
    			$html ='';
    			// The Loop
    		if ( $query->have_posts() ) {
    			while ( $query->have_posts() ) {
    			$query->the_post();
    
    					$html .= '<div class="grid_container" style="padding-bottom: 20px;">';
    					$html .= '<a href="'.get_permalink().'" class="grid hall_of_fame" title="">'.get_the_post_thumbnail($eh,'hero_secondary').'<span></span><p>VIEW PROJECT <span class="hof_more"></span></p></a>';
    					$html .= '<h5><a href="'.get_permalink().'" rel="bookmark">'.get_the_title().'<span class="more"> </span></a></h5>';
    					$html .= '</div>';
    
    			}
    
    			$html .= $apiclass->ajax_pagination($arg['paged'],$query->max_num_pages, 4, $id);
    		 } else {
    					$html .= __( 'Nothing Found', 'AjWPQSF' );
    				}
    				/* Restore original Post Data */
    				wp_reset_postdata();
    
    			return $html;
    
    	   }
Viewing 15 replies - 1 through 15 (of 29 total)
  • The topic ‘Costumize result template’ is closed to new replies.