Fix server-rendered pagination links to use hash format
Update paginate_links() in both property-results.php and ajax-handlers.php to generate #page=N links instead of ?paged=N query parameters. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -98,10 +98,10 @@ function homeproz_ajax_filter_properties() {
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// Build pagination
|
||||
// Build pagination with hash-based page numbers
|
||||
$base_url = get_post_type_archive_link('property');
|
||||
|
||||
// Build URL with current filters
|
||||
// Build URL with current filters in query string
|
||||
$filter_args = array();
|
||||
if ($property_type) $filter_args['property_type'] = $property_type;
|
||||
if ($property_location) $filter_args['property_location'] = $property_location;
|
||||
@@ -109,15 +109,17 @@ function homeproz_ajax_filter_properties() {
|
||||
if ($max_price) $filter_args['max_price'] = $max_price;
|
||||
if ($beds) $filter_args['beds'] = $beds;
|
||||
|
||||
// Add filters to base URL, page goes in hash
|
||||
$filtered_url = !empty($filter_args) ? add_query_arg($filter_args, $base_url) : $base_url;
|
||||
|
||||
$pagination = paginate_links(array(
|
||||
'base' => add_query_arg('paged', '%#%', $base_url),
|
||||
'base' => $filtered_url . '#page=%#%',
|
||||
'format' => '',
|
||||
'current' => max(1, $paged),
|
||||
'total' => $max_pages,
|
||||
'prev_text' => '← Previous',
|
||||
'next_text' => 'Next →',
|
||||
'type' => 'array',
|
||||
'add_args' => $filter_args,
|
||||
));
|
||||
|
||||
if ($pagination) :
|
||||
|
||||
@@ -96,11 +96,11 @@ $paged_properties = mls_get_properties($mls_args);
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// Pagination
|
||||
$big = 999999999;
|
||||
// Pagination with hash-based page numbers (prevents WordPress server-side conflicts)
|
||||
$base_url = get_post_type_archive_link('property');
|
||||
$pagination = paginate_links(array(
|
||||
'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
|
||||
'format' => '?paged=%#%',
|
||||
'base' => $base_url . '#page=%#%',
|
||||
'format' => '',
|
||||
'current' => max(1, $paged),
|
||||
'total' => $max_pages,
|
||||
'prev_text' => '← Previous',
|
||||
|
||||
Reference in New Issue
Block a user