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:
Hanson.xyz Dev
2025-12-16 00:10:29 -06:00
parent b7eb0de882
commit fe29eb74c4
2 changed files with 10 additions and 8 deletions
@@ -98,10 +98,10 @@ function homeproz_ajax_filter_properties() {
</div> </div>
<?php <?php
// Build pagination // Build pagination with hash-based page numbers
$base_url = get_post_type_archive_link('property'); $base_url = get_post_type_archive_link('property');
// Build URL with current filters // Build URL with current filters in query string
$filter_args = array(); $filter_args = array();
if ($property_type) $filter_args['property_type'] = $property_type; if ($property_type) $filter_args['property_type'] = $property_type;
if ($property_location) $filter_args['property_location'] = $property_location; 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 ($max_price) $filter_args['max_price'] = $max_price;
if ($beds) $filter_args['beds'] = $beds; 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( $pagination = paginate_links(array(
'base' => add_query_arg('paged', '%#%', $base_url), 'base' => $filtered_url . '#page=%#%',
'format' => '', 'format' => '',
'current' => max(1, $paged), 'current' => max(1, $paged),
'total' => $max_pages, 'total' => $max_pages,
'prev_text' => '&larr; Previous', 'prev_text' => '&larr; Previous',
'next_text' => 'Next &rarr;', 'next_text' => 'Next &rarr;',
'type' => 'array', 'type' => 'array',
'add_args' => $filter_args,
)); ));
if ($pagination) : if ($pagination) :
@@ -96,11 +96,11 @@ $paged_properties = mls_get_properties($mls_args);
</div> </div>
<?php <?php
// Pagination // Pagination with hash-based page numbers (prevents WordPress server-side conflicts)
$big = 999999999; $base_url = get_post_type_archive_link('property');
$pagination = paginate_links(array( $pagination = paginate_links(array(
'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), 'base' => $base_url . '#page=%#%',
'format' => '?paged=%#%', 'format' => '',
'current' => max(1, $paged), 'current' => max(1, $paged),
'total' => $max_pages, 'total' => $max_pages,
'prev_text' => '&larr; Previous', 'prev_text' => '&larr; Previous',