Listings Page Displays Only 10 Listings
-
My main listings page, that is now on my menu, will only display 10 listings. I have 12 listings to be displayed, and more to come. There is space on the page for twelve listings, but there is white space where listings 11 and 12 should be. How do I change the plug-in to display more listings on my listings page?
https://www.ads-software.com/extend/plugins/agentpress-listings/
-
I’m going to chime in that this is a non-trivial issue that I’m currently wrestling with, amongst others.
While AgentPress Listings is a free plugin for Genesis users, which I am always appreciative of. However, it is not on the level of “premium” matching StudioPress’s templates and other plugins.
@russell: I’m not sure if you’re using the AgentPress theme as well, but I’m going to assume you are. It appears that taxonomy.php is the file you’ll need to edit, even though it is 99% identical to archive-listing.php — I don’t quite understand why that is.
To the point: I’ve found that taxonomy.php executes a custom loop that automagically gets the post type, taxonomy, and taxonomy term of the “page” that’s in your menu and spits out the results for listings that fall under that term (in my case the taxonomy is “property-type” and the terms are something like “retail-space”).
You’re trying to get more listings to show. I’m trying to only show 9 at a time, but paginate them, and get listings to show in order of title. This without a doubt requires modifying the custom loop. The code I used didn’t give me anything close to what either of us are asking here, but I’ll share it with you in hopes that you or someone else may see things from a different angle and provide a fix:
add_action( 'genesis_loop', 'agentpress_listing_archive_loop' ); /** * Custom loop for listing archive page */ function agentpress_listing_archive_loop() { $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); $listingQuery = new WP_Query( array( 'post_type' => 'listing', //custom post type 'presets' => $term->slug, 'posts_per_page' => 9, // get all posts (from custom post type) 'orderby' => 'title', //sort by my meta_key (following next) 'order' => 'ASC', /*order, starting from smallest to biggest */ 'paged' => $paged ) ); $toggle = ''; if ($listingQuery->have_posts() ) : while ( $listingQuery->have_posts() ) : $listingQuery->the_post(); $loop = ''; // init $loop .= sprintf( '<a href="%s">%s</a>', get_permalink(), genesis_get_image( array( 'size' => 'properties' ) ) ); $loop .= sprintf( '<span class="listing-price">%s</span>', genesis_get_custom_field( '_listing_price' ) ); $loop .= sprintf( '<span class="listing-text">%s</span>', genesis_get_custom_field( '_listing_text' ) ); $loop .= sprintf( '<span class="listing-address">%s</span>', genesis_get_custom_field( '_listing_address' ) ); $loop .= sprintf( '<span class="listing-city-state-zip">%s, %s %s</span>', genesis_get_custom_field( '_listing_city' ), genesis_get_custom_field( '_listing_state' ), genesis_get_custom_field('_listing_zip' ) ); $loop .= sprintf( '<a href="%s" class="more-link">%s</a>', get_permalink(), __( 'View Listing', 'agentpress' ) ); $toggle = $toggle == 'left' ? 'right' : 'left'; /** wrap in post class div, and output **/ printf( '<div class="%s"><div class="widget-wrap"><div class="listing-wrap">%s</div></div></div>', join( ' ', get_post_class( $toggle ) ), $loop ); endwhile; endif; }
If you do posts_per_page of -1 then it will show all posts that match the other criteria in the query.
The codex page on the WP query is https://codex.www.ads-software.com/Class_Reference/WP_Query
Thanks, but my above code still works in an entirely broken and undesirable manner. With that change AgentPress (theme or Listings, who knows?!?) displays every listing within the listing post type, instead of auto-detecting the slug and outputting only what belongs in that term archive. There are odd breaks in the way it deals with rows and columns once (in my case) the 50 or so listings I have render out, which seems to be an error with $toggle.
I’m trying to figure out the strange relationship between the theme template and the plugin and quite frankly it’s baffling. What is taxonomy.php relying on from the plugin in order to generate an archive of term listings? How does that taxonomy.php factor into search? What about pagination?
I don’t mean to be out of line, Ron, but I’ve wasted a ton of billable time and sanity trying to work around this to no avail, when it should really function more sensibly. If I tried to get my realtor/client to use this system as-is (like I was going to) he would have my head.
The templates in the AgentPress theme are given those names because the template with that name is what WordPress looks for to determine which template to use.
See https://codex.www.ads-software.com/Template_Hierarchy for the template hierarchy used by WP. If you click on the image about half way down the page it will give you the full sized image.
I’m in agreement with hifidesign – this plugin/theme combination is dreadfull. So dreadful It baffles to me as to why you have even released this. Its supposed to be for a noob that has no knowledge of coding and yet you leave out so much essential functionality its a joke and then when anyone asks you for any real support you just refer them to the wordpress reference (which would never help a noob) or tell them they can contact your developer and pay him to make the fix!
Im actually not a noob and I dont think hifidesign is either and the plug in is totally baffling – you provide no documentation whatsoever and seem to have made absolutely no effort in fixing some of the essential problems which the plug in has had for a very long time.
So how can a plugin that is meant for a real estate agent with no coding skills have the following problems?
1. It doesnt order properties by price (and don’t say that ordering by taxanomy (which you dont even provide an option for and a noob would take a long time to figure out) is an option as it is just a price range) So the noob has to figure out how to hack the listings-search file so that it orders by the custom field _listing_price. The noob will have to take some serious php and wordpress classes to work out queries and even if they did they would still be totally baffled by the way the plugin is set up.
2. After selecting a taxonomy and performing a search it only shows 10 listings (what this thread is about) – yeah this totally makes sense the other 90 listings the agent has will just never show – nice one! So the noob finds that he can increase the setting in the reader settings but then doesn’t have pagination so has to figure that out too – jeeees!
3. You dont even have a “no properties found” if the listings return null.
I wish I could just walk away from this terrible plug in and never see it again – id prefer to build a theme totally from scatch – but I’m in the unfortunate position of taking over from another developer who chose to use this terrible plugin and I’m having to spend hours trawling the web to figure out how to make this into the most basic of real estate websites. In the end I think I’m going to ditch it as its just too much hassle and spend my evenings after work (as its difficult to explain to my boss why such simple functionality is so hard to add to the theme) coding it from scratch myself.
Anyone considering using this template please take a look at these points and consider whether you can afford to have such an unprofessional website.
Honestly Ron – it may work for the most unprofessional smallest real estate agents (who have 8 listings at a time) but for the rest of the developers that have the unfortunate job of hacking your plugin you have caused SO SO MANY HOURS of frustration!
@stokesy ( & @hifidesign ) – with no disresepect, I think you both misunderstand the division between plugin and theme.
The AgentPress Listings plugin provides your site with the custom post type, the ability to add custom taxonomies & terms, the property listing widget and the property search widget.
All of the questions posted in this thread are either about WP settings, theme template files, custom queries for said templates, etc.
While it is possible to modify the APL plugin to accomplish some of the things listed here, it is much easier to accomplish those things in your WP settings, the specific template and/or your child theme functions file. The reason things are architected this way is that you do not lose your customizations when you update either Genesis or the APL plugin.
you just refer them to the wordpress reference
Yes, (for example) if you are trying to customize your theme and are not familiar with which templates WP uses for which purposes a reference which provides that information is useful.
As an actual noob, I can say I share the same problem as hifi and stokesy.
The search results only list 10 homes, max, which actually would be fine, except, well… I have more than ten homes to list. ??
I have been trying to figure out a solution for the last couple of days, but honestly am quite lost. I wish I could use this plugin because it looks really nice, but just don’t know how I can, at least right now.
I understand that it might be all a matter of flipping a few WP settings, or switching theme template files, etc.
If any of you might be willing to break it down for me, step by step, I would be deeply appreciative. Even say doing just what hifidesign suggested, i.e., just listing 9 homes per page and adding some pagination, that would be fabulous.
I would gladly buy you a virtual beer.
Thanks so much.
D
Hi David
Ive finally fixed all the problems I listed and others and will be writing up a definitive AgentPress fix guide over the weekend to help all those out there who are struggling with the same problems.
I would write it up now but its 5pm, I’ve just finished work and ready to go have some beers – BUT! I will post it on Sunday and will send you a link.
I will be covering:
1. How to correctly order taxonomies in search drop downs.
2. How to handle amount of listings per page and pagination.
3. How to order Listings by the custom price field
4. How to add a “no results found message” on search results page
As well as several other mods which are unrelated to this plugin which I think most people building a real estate website will be interested in.
Until Sunday!
Have a good weekend!
Thank you, thank you, thank you stokesy! You’re the best!
Cheers and have a good weekend.
Best,
DavidPS. This one’s on me. ??
_.._..,_,_ ( ) ]~,"-.-~~[ .=])' (; ([ | ]:: ' [ '=]): .) ([ |:: ' | ~~----~~
I have the same problem with the AgentPress plugin when I ran across this thread. I am interested in the fixes that stokesy has found.
When using the Search Box [https://diamondbarsland.com/property-type/diamond-bar-properties/?s&post_type=listing&features&property-location&price-range], the problems present themselves. However, when directly linking to the taxonomy page [https://diamondbarsland.com/property-type/diamond-bar-properties/], the listings do, sort of, paginate. At least they are all there.
Please keep me in the loop for your write-up, stokesy. Thanks very much in advance!
JoAnn
Sorry for the delay
You can find the write up here
https://ryanmstokes.com/blog/wordpress/fixing-agent-press
I had to rush writing it as I have so much work on right now – let me know if you have any problems or If I didn’t explain any of the points well.
I hope this helps out a lot of people!
Regards
Ryan
Thank you so much Ryan for your time and expertise in helping us all with this major problem. I know we all greatly appreciate it!
Kind regards,
JoAnn@ron, we do appreciate your work on the plugin and the support as well. Our problem is simply this (and it’s not even a remotely debatable point):
Regardless of the plugin/child theme arrangement, the way AgentPress & AGL are being bundled and marketed is disingenuous. We know StudioPress makes good products and this feels like it was phoned it. I would like to see both the plugin and theme revised so that noobs and intermediate-level folks don’t have to go through the pains we have. That’s really the goal over there at CopyBlogger/StudioPress, right? To be friendly toward the experienced and inexperience alike, and augment the WordPress experience for the better.
@ryan, I tried to post on your blog, but every time I changed tabs to grab a link, my message got erased from the textarea. So I’m posting here first and will also post the info below for others over there.
I would build the following into your mods.
https://www.ads-software.com/support/topic/sorting-the-widget-taxonomies?replies=4
https://www.studiopress.com/forums/topic/removing-comma-on-agentpress-featured-listing-widget/
My boss found this pagination fix, which is a little different than yours, but I can verify it works:
https://www.studiopress.com/forums/topic/page-navigation-missing-on-agentpress/
@hifidesign – I’m going to comment on a couple things you mentioned in the thread on the StudioPress forums:
APL since it’s a third-party plugin
That’s not the case. It’s an official SP plugin.
“it’s the child theme’s fault”, “it’s the plugin’s fault”
I apologize that my explanation appeared to be doing that. What I was trying to explain was that you should be customizing the child theme vs modifying the plugin.
Hi @hifidesign
Sorry i just threw that blog up quickly and will look into the comments issue – your comment is on there now.
The widget taxonomy fix in that link will work but my client wanted to order property types and locations in a specific way (e.g. villas, apartments, townhouses, commercial) and so my work around (although not so gracious) allows for that. I think most agents will want to do that from my experience.
Thanks for the heads up on the page navigation fix – I will test that now – it definitely looks better than repeating the code in different php files.
You also have to add the price currency and price formatting in the functions.php file in the featured listings widget function to get the featured listings on the home page to look right. I will be adding that to my post.
Kind Regards
- The topic ‘Listings Page Displays Only 10 Listings’ is closed to new replies.