Number of listings on search page
This topic contains 29 replies, has 4 voices, and was last updated by Birgit Wilde 5 years, 12 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
March 23, 2019 at 11:58 am #476055
Hello,
despite the respective settings inWP->Reading-> max. 25 Blog listings per page (see screenshot)
on my GD search page really ALL listings of a CPT are shown.
Also in my theme (supreme directory v2) I could not find anything that overrides this WP-setting.
(Well, I am actually not that person who sees which css code may override other functions).Any idea?
And once there is a pagination and limited number of listings on the search page displayd, I still would like to have the pins of ALL listings displayd on the GD map on my search page.
How can I achieve that?
Best regards
BirgitMarch 23, 2019 at 12:10 pm #476057You need to change this code on line 9 of /wp-content/themes/supreme-directory/content-geodirectory-archive.php
<?php echo do_shortcode('[gd_map width="100%" height="100vh" maptype="ROADMAP" zoom="0" map_type="auto"]');?>
Just add all_posts=”1″ to that shortcode.
If we need to check anything else, post your URL and WP admin details in a private reply.
Thanks
March 25, 2019 at 2:05 pm #476326This reply has been marked as private.March 25, 2019 at 2:48 pm #476336I de-activated your code snippets. One of them is breaking the category and search page.
Turn the snippets on one by one again to find the error.
ThanksMarch 25, 2019 at 3:01 pm #476339Hi Guust,
great, thank you. I will check the snippets.Now the map on the right side shows onlay as many listings as are displaid on the left. How can I achieve it that the map on the right shows ALL listings while on the left only xx listings per page are dislaid?
Many thanks
BirgitMarch 25, 2019 at 3:36 pm #476344Ah, I found the snippet.
It is exactly the one managing that even though there are not all listings displaid at once on the lefthand side of the search page, the map on the right shows all listings.This code I got from some entry in the forum (see below).
How to I have to adjust this code to make it work for GDV2?function show_more_posts($query) {
if ( empty( $query->query_vars[‘suppress_filters’] ) ) {
if( geodir_is_page(‘listing’) || geodir_is_page(‘author’) || geodir_is_page(‘search’) ) {
$query->set( ‘posts_per_page’, -1 );
}
}
return $query;
}
add_filter( ‘pre_get_posts’ , ‘show_more_posts’ );March 25, 2019 at 10:41 pm #476405To get the same thing working in V2, see this post:
https://wpgeodirectory.com/support/topic/number-of-listings-on-search-page/#post-476057March 26, 2019 at 12:03 pm #476465Hi Guust,
the snippet that broke the pagination is deactivated and I have added the php-code all_posts=”1″ as described (see screenshot) and uploaded it back on the FTP-server.
Now I have my pagination back, but the map does not show all listings of a CPT but only those listed on the left.
Any idea?
Many thanks
BirgitMarch 26, 2019 at 1:00 pm #476474This reply has been marked as private.March 27, 2019 at 10:32 am #476656Hi Birgit,
Pleas check now.
In file /themes/supreme-directory/content-geodirectory-archive.php i have added all_posts=1 in gd_map shortcodes.
Regards,
KiranMarch 28, 2019 at 7:33 am #476818Hi Kiran,
sorry, it seems it doesn’t work yet. The map on GD Archive still shows just those listings that are currently listed on the lefthand side of GD Archive.
Any other idea?
Many thanks and best regards
BirgitMarch 28, 2019 at 3:03 pm #476910Hi,
The archive map will only show all the listings in the loop, so, whatever is returned by the loop will shop on the map.
Make sense?
March 31, 2019 at 8:15 am #477208Hi Alex,
by “all the listings in the loop” do you mean only those listings displaid on the lefthand side (amount depending on page settings)? This is how it is right now.It would be so much better if the visitor/user could see at a glance that there are many more listings in this database and where about in Germany they are.
Therefore I used to have this lovely snippet from the support team (see screenshot) which now with GDV2 doesn’t work properly anymore.
The next step to perfection would be to display the listings currently listed on the lefthand side on the map with map pins and all the other listings as little dots. Thus the user could see where else in Germany the database provides listings and at the same time know the locations of the listings currently shown on the lefthand side. Okay, this might be really a matter of individual customization.
But for now it would be great to be able to just show all listings on the map, resp. to gain back the functionality of that snippet.
Any idea?
Many thanks
BirgitMarch 31, 2019 at 12:40 pm #477222By loop I mean the GD Loop element, which shows the main query for the archive page, whichever archive page it is.
Showing listings from a GD Listings shortcode in a map is not possible except by using the directory map element with filters matched to a gd listings element.
If you want more than that right now you will need to customize it.
March 31, 2019 at 1:02 pm #477223The archive page for example “loops” through all listings in that custom post type, and finds about a thousand.
Because the left hand side is set to 25 listings, a 1000 listings will be divided in 40 pages.
Because the right hand side is set to show all in the “loop” it will show all there, see image. -
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket