Skip to content

Instantly share code, notes, and snippets.

@hivepress
Last active Jan 30, 2023
Embed
What would you like to do?
Change the maximum number of images per listing #hivepress #listings
<?php
add_filter(
'hivepress/v1/models/listing',
function( $model ) {
$model['fields']['images']['max_files'] = 123;
return $model;
},
100
);
@Serranospc
Copy link

Copied exactly as described and generated fatal error. I'm not a programmer. What should I do to limit ads to a maximum of 3 images
fatal error
?

@hivepress
Copy link
Author

The code snippet seems to be ok, please try using the Code Snippets plugin for adding it, also please don't copy the first line <?php since it's pre-added by the Code Snippets plugin.

@Serranospc
Copy link

Serranospc commented Apr 29, 2022

Perfect!
Is it possible to include video url?

@hivepress
Copy link
Author

Sorry, it's not possible for the listing image gallery yet, but it's possible to add video URLs to the listing description (e.g. YouTube, Vimeo...) and they will be converted into a video player on the listing page. Also you can use the Embed attributes in the same way.

@28south-james
Copy link

Any way to have different limits depending on the listing package purchased?

@tejas2292
Copy link

image

Is it correct?? because its not working though i have tried for request

@hivepress
Copy link
Author

Please replace "listing" with "request" in the hook name then this snippet should work fine for requests.

Unfortunately there's no way to limit this per package in the current version.

@guizeras
Copy link

Work perfectly. Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment