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 July 17, 2024 23:59
Allow selecting multiple categories in the back-end listing form #hivepress #listings
<?php
add_filter(
'hivepress/v1/meta_boxes/listing_attributes',
function( $meta_box ) {
if ( isset( $meta_box['fields']['categories'] ) ) {
$meta_box['fields']['categories']['multiple'] = true;
unset( $meta_box['fields']['categories']['attributes']['data-multistep'] );
}
return $meta_box;
@hivepress
hivepress / functions.php
Created February 20, 2023 22:59
Add description to the price extras in the listing form #hivepress #marketplace
<?php
add_filter(
'hivepress/v1/forms/listing_update',
function( $form ) {
if ( isset( $form['fields']['price_extras'] ) ) {
$form['fields']['price_extras']['description'] = 'custom text here';
}
return $form;
},
@hivepress
hivepress / functions.php
Created February 20, 2023 22:58
Add description to the pricing tiers in the listing form #hivepress #marketplace
<?php
add_filter(
'hivepress/v1/forms/listing_update',
function( $form ) {
if ( isset( $form['fields']['price_tiers'] ) ) {
$form['fields']['price_tiers']['description'] = 'custom text here';
}
return $form;
},
@hivepress
hivepress / functions.php
Created February 20, 2023 22:54
Add placeholder text to the listing description field #hivepress #listings
<?php
add_filter(
'hivepress/v1/forms/listing_update',
function( $form ) {
$form['fields']['description']['placeholder'] = 'custom text here';
return $form;
},
1000
);
@hivepress
hivepress / functions.php
Created February 20, 2023 22:49
Add description to the Tags field in the listing form #hivepress #tags
<?php
add_filter(
'hivepress/v1/forms/listing_update',
function( $form ) {
if ( isset( $form['fields']['tags'] ) ) {
$form['fields']['tags']['description'] = 'custom text here';
}
return $form;
},
@hivepress
hivepress / style.css
Created February 20, 2023 22:47
Hide the listing sort drop-down #hivepress #listings
.hp-form--listing-sort {
display: none !important;
}
@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
);