Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

robertosalemi on "Search Page: pagination does not work"

$
0
0

Hello to all,
I customized the work of research, I'll explain:

1 ) I made a search input in ajax when use the query :

$sql = "SELECT DISTINCT(post_title) FROM wp_posts WHERE post_type = 'portfolio' and post_title like '%$q%' and post_status = 'publish' ";

where $q is the text in the search input.

2) the final url is: nomesito.it/?s=TermineCercato&post_type=portfolio

3) in the template file seach.php I added:

<?php
if(isset($_GET['post_type']) and $_GET['post_type']=='portfolio'){
	get_template_part( 'loop' , 'entrySearch');
} else {
	get_template_part( 'loop' , 'entry');
}
?>

so in my case the file is called loop- entrySeach.php where they are displayed only 10 items per page.

This all works fine.
The problem occurs when the items are more than 10 and therefore appears pagination.
The proposed WP url for the second page is nomesito.it/page/2/?s=TermineCercato&post_type=portfolio, to click on it but I reloads the homepage of the site.

How can I fix?

Thank you.


Viewing all articles
Browse latest Browse all 8245

Trending Articles