Skip to content

Instantly share code, notes, and snippets.

View hivepress's full-sized avatar

HivePress hivepress

View GitHub Profile
@hivepress
hivepress / functions.php
Last active February 27, 2024 09:46
Change the maximum number of images per listing #hivepress #listings
View functions.php
<?php
add_filter(
'hivepress/v1/models/listing',
function( $model ) {
$model['fields']['images']['max_files'] = 123;
return $model;
},
100
);
@hivepress
hivepress / style.css
Created April 27, 2022 10:12
Disable the sticky sidebar on all HivePress pages #hivepress #templates
View style.css
.hp-template .inner-wrapper-sticky {
position: static!important;
transform: none!important;
}
@hivepress
hivepress / functions.php
Created February 20, 2023 20:50
Restrict decimals in the payout request amount #hivepress #marketplace
View functions.php
<?php
add_filter(
'hivepress/v1/forms/payout_request',
function( $form ) {
$form['fields']['amount']['type'] = 'number';
$form['fields']['amount']['decimals'] = 0;
$form['fields']['amount']['min_value'] = 0;
return $form;
},
@hivepress
hivepress / functions.php
Created February 20, 2023 21:17
Make the location field required in the listing search form #hivepress #geolocation
View functions.php
<?php
add_filter(
'hivepress/v1/forms/listing_search',
function( $form ) {
if ( isset( $form['fields']['location'] ) ) {
$form['fields']['location']['required'] = true;
}
return $form;
},
@hivepress
hivepress / functions.php
Created April 27, 2022 09:53
Add description to the details field in the payout request form #hivepress #marketplace
View functions.php
<?php
add_filter(
'hivepress/v1/forms/payout_request',
function( $form ) {
$form['fields']['details']['description'] = 'custom text here';
return $form;
},
1000
);
@hivepress
hivepress / functions.php
Created May 29, 2022 16:57
Add description to the note field in the order delivery form #hivepress #marketplace
View functions.php
<?php
add_filter(
'hivepress/v1/forms/order_deliver',
function( $form ) {
$form['fields']['note']['description'] = 'custom text here';
return $form;
},
1000
);
@hivepress
hivepress / style.css
Created April 26, 2022 16:21
Hide the listing publication date #hivepress #listings
View style.css
.hp-listing--view-block .hp-listing__created-date,
.hp-listing--view-page .hp-listing__created-date {
display: none;
}
@hivepress
hivepress / functions.php
Created May 4, 2022 20:18
Limit the maximum number of listings per user account #hivepress #listings
View functions.php
<?php
add_filter(
'hivepress/v1/forms/listing_submit/errors',
function( $errors, $form ) {
$listing = $form->get_model();
if ( $listing && $listing->get_user__id() ) {
$listing_count = \HivePress\Models\Listing::query()->filter(
[
'status__in' => [ 'publish', 'pending', 'draft' ],
@hivepress
hivepress / template.html
Last active January 30, 2024 10:17
Style the URL attribute as a button (display format) #hivepress #attributes
View template.html
<a class="button button--primary hp-button hp-button--wide" href="%value%" target="_blank" rel="nofollow">Button Text</a>
@hivepress
hivepress / style.css
Last active January 30, 2024 07:04
Make the location link non-clickable for listings #hivepress #geolocation
View style.css
.hp-listing--view-block .hp-listing__location a,
.hp-listing--view-page .hp-listing__location a {
pointer-events: none;
}