Skip to content

Instantly share code, notes, and snippets.

View hivepress's full-sized avatar

HivePress hivepress

View GitHub Profile
@hivepress
hivepress / functions.php
Created February 20, 2023 22:36
Change the maximum text length for reviews #hivepress #reviews
<?php
add_filter(
'hivepress/v1/forms/review_submit',
function( $form ) {
$form['fields']['text']['max_length'] = 123;
return $form;
},
1000
);
@hivepress
hivepress / functions.php
Created February 20, 2023 22:34
Require adding at least one price extra to listings #hivepress #marketplace
<?php
add_filter(
'hivepress/v1/models/listing/attributes',
function( $attributes ) {
if ( isset( $attributes['price_extras'] ) ) {
$attributes['price_extras']['edit_field']['required'] = true;
}
return $attributes;
},
@hivepress
hivepress / functions.php
Created February 20, 2023 21:17
Make the location field required in the listing search form #hivepress #geolocation
<?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 February 20, 2023 21:13
Hide the location section from the listing pages #hivepress #geolocation #rentalhive
<?php
add_filter(
'hivepress/v1/templates/listing_view_page',
function( $template ) {
hivepress()->template->fetch_block( $template, 'location_container' );
return $template;
},
1000
);
@hivepress
hivepress / functions.php
Created February 20, 2023 21:07
Show Settings as the first account menu item #hivepress #users
<?php
add_filter(
'hivepress/v1/menus/user_account',
function( $menu ) {
if ( isset( $menu['items']['user_edit_settings'] ) ) {
$menu['items']['user_edit_settings']['_order'] = 1;
}
return $menu;
},
@hivepress
hivepress / style.css
Created February 20, 2023 21:02
Hide the Delete Account link from users #hivepress #users
.hp-form__action--user-delete {
display: none !important;
}
@hivepress
hivepress / functions.php
Created February 20, 2023 20:50
Restrict decimals in the payout request amount #hivepress #marketplace
<?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 20:40
Show the listing image instead of the vendor image for listings #hivepress #experthive
<?php
add_filter(
'hivepress/v1/templates/listing_view_block/blocks',
function( $blocks ) {
return hivepress()->helper->merge_trees(
[ 'blocks' => $blocks ],
[
'blocks' => [
'listing_image' => [
'path' => 'listing/view/block/listing-image',
@hivepress
hivepress / functions.php
Created February 20, 2023 20:38
Make the Details text field optional for offers #hivepress #requests
<?php
add_filter(
'hivepress/v1/models/offer',
function ( $model ) {
$model['fields']['text']['required'] = false;
return $model;
},
1000
);
@hivepress
hivepress / functions.php
Created February 20, 2023 20:33
Require adding at least one tag for listings #hivepress #tags
<?php
add_filter(
'hivepress/v1/models/listing',
function( $model ) {
if ( isset( $model['fields']['tags'] ) ) {
$model['fields']['tags']['required'] = true;
}
return $model;
},