Skip to content

Instantly share code, notes, and snippets.

View hivepress's full-sized avatar

HivePress hivepress

View GitHub Profile
@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;
},
@hivepress
hivepress / functions.php
Created February 20, 2023 20:28
Restrict making offers to vendors with at least 1 listing #hivepress #requests
<?php
add_filter(
'hivepress/v1/forms/offer_make/errors',
function( $errors ) {
$listing_id = \HivePress\Models\Listing::query()->filter(
[
'status' => 'publish',
'user' => get_current_user_id(),
]
)->get_first_id();
@hivepress
hivepress / functions.php
Created February 20, 2023 20:18
Remove options for sorting listings by rating #hivepress #reviews
<?php
add_filter(
'hivepress/v1/forms/listing_sort',
function( $form ) {
unset( $form['fields']['_sort']['options']['rating__asc'], $form['fields']['_sort']['options']['rating__desc'] );
return $form;
},
1000
);
@hivepress
hivepress / functions.php
Last active February 20, 2023 20:13
Remove the text field from reviews #hivepress #reviews
<?php
add_filter(
'hivepress/v1/forms/review_submit',
function( $form ) {
unset( $form['fields']['text'] );
return $form;
},
1000
);
@hivepress
hivepress / functions.php
Created February 20, 2023 20:08
Remove the price range search filter for listings #hivepress #marketplace
<?php
add_filter(
'hivepress/v1/forms/listing_filter',
function( $form ) {
unset($form['fields']['price']);
return $form;
},
1000
);
@hivepress
hivepress / functions.php
Created December 7, 2022 15:55
Change the Add Details page title for listings #hivepress #listings
<?php
add_filter(
'hivepress/v1/routes',
function( $routes ) {
$routes['listing_submit_details_page']['title'] = 'Custom title here';
return $routes;
},
1000
);