Need Help Decreasing A PHP loop from 12 to 3

Hi there I have some code which can be found here: https://github.com/propertyhive/WP-Property-Hive/blob/master/templates/content-property-recent.php

It outputs 12 properties in a recent properties section however no matter what I try I can't workout how to output 3 properties instead of the 12. I'd like all 3 on one line so 3 columns.

The website that it's on is http://www.arc.globedigitaltesting.xyz if you scroll down to the first featured properties section it's beneath that and it's currently displaying a very messy 12 properties.

Any help greatly appreciated,

thanks!

  • Adam Czajczyk

    Hello Ryan,

    I hope you're well today and thank you for your question!

    The code that you shared is for displaying the simple property only withing the loop. In other words, it is responsible for showing single "cell" (e.g. "Briar close, Darlington" property "box" on page). Therefore we can't limit that in this place.

    I'm not familiar with the theme that you are using and since it's premium theme I don't have access to it. Because of that I'm not quite able to give you a straight answer "out of the box" but there should be another template file that includes a WP loop an that calls this template out. We would want to modify query in that template.

    In order to be able to give you a better advice I would need to check theme files. If there's a theme file editor available on your site ("Appearance -> Edit") I could probably use it to review these files. To let me do this you could enable support access to your site for me, as explained here:

    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Let me know please if I can proceed that way :slight_smile:

    Best regards,
    Adam

  • Ryan Prior

    Hi Adam,

    Thanks for the reply, I was under the assumption that the code was in the file as the shortcode info here in the documentation says that it can be found there https://wp-property-hive.com/documentation/shortcodes/

    I've enabled support access for you on the website at the moment, the theme is Realtyspace however the theme is fully integrated with a property system, but it didn't work for us so i'm using the property hive plugin over the top, integration is difficult due to how the property system in the existing theme works however this is the last thing that we need to do but I just can't find out how to reduce what's being displayed down from 12 to 3. I assume this file will be in the plugin folder though as all of the properties are being shown via that plugin. At the moment I haven't got the child theme installed, I will be doing this next so if you happen to edit anything please let me know.

    Thanks so much for the help it's hugely appreciated!

  • Adam Czajczyk

    Hello Ryan!

    Thank you for your replay. However, I'm quite confused now.

    The site looks very different to what it was when I first visited it. There are only these three properties displayed right below the slider and then there's a different content.

    Would it be possible that you set it up the way it was when I first replied to you? Or at least that you add that "12-properties-listing" somewhere on the page so I could see it in action before digging into site configuration/files?

    That would help a lot :slight_smile:

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.