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 April 26, 2022 17:18
Change the description field order in the listing edit form #hivepress #listings
<?php
add_filter(
'hivepress/v1/forms/listing_update',
function( $form ) {
$form['fields']['description']['_order'] = 123;
return $form;
},
1000
);
@hivepress
hivepress / functions.php
Created April 26, 2022 17:19
Change the opening hours field order in the listing edit form #hivepress #opening-hours
<?php
add_filter(
'hivepress/v1/forms/listing_update',
function( $form ) {
if ( isset( $form['fields']['opening_hours'] ) ) {
$form['fields']['opening_hours']['_order'] = 123;
}
return $form;
},
@hivepress
hivepress / functions.php
Last active April 26, 2022 17:19
Remove the Open Now filter from the listing search #hivepress #opening-hours
<?php
add_filter(
'hivepress/v1/forms/listing_filter',
function( $form ) {
unset($form['fields']['_open']);
return $form;
},
1000
);
@hivepress
hivepress / functions.php
Created April 26, 2022 17:28
Make pricing tiers required for marketplace listings #hivepress #marketplace
<?php
add_filter(
'hivepress/v1/models/listing/attributes',
function( $attributes ) {
if ( isset( $attributes['price_tiers'] ) ) {
$attributes['price_tiers']['edit_field']['required'] = true;
}
return $attributes;
},
@hivepress
hivepress / functions.php
Created April 26, 2022 17:29
Make the price field optional for marketplace listings #hivepress #marketplace
<?php
add_filter(
'hivepress/v1/models/listing/attributes',
function( $attributes ) {
if ( isset( $attributes['price'] ) ) {
$attributes['price']['edit_field']['required'] = false;
}
return $attributes;
},
@hivepress
hivepress / functions.php
Last active April 26, 2022 17:35
Enable rich text (HTML) editor for the user profile description #hivepress #users
<?php
add_filter(
'hivepress/v1/models/user',
function( $model ) {
$model['fields']['description']['editor'] = true;
return $model;
},
1000
);
@hivepress
hivepress / functions.php
Created April 26, 2022 17:40
Change the image gallery order (position) on the single listing page #hivepress #listings
<?php
add_filter(
'hivepress/v1/templates/listing_view_page',
function( $template ) {
return hivepress()->helper->merge_trees(
$template,
[
'blocks' => [
'listing_images' => [
'_order' => 123,
@hivepress
hivepress / functions.php
Created April 26, 2022 17:41
Disable the HivePress cache #hivepress #cache
<?php
if ( ! defined( 'HP_CACHE' ) ) {
define( 'HP_CACHE', false );
}
@hivepress
hivepress / functions.php
Last active April 26, 2022 17:47
Change the columns number on the listing category selection page #hivepress #listing-categories
<?php
add_filter(
'hivepress/v1/templates/listing_submit_category_page',
function( $template ) {
return hivepress()->helper->merge_trees(
$template,
[
'blocks' => [
'listing_categories' => [
'columns' => 3,
@hivepress
hivepress / functions.php
Created April 26, 2022 17:53
Hide the profile description field in the user profile form #hivepress #users
<?php
add_filter(
'hivepress/v1/forms/user_update',
function( $form ) {
unset( $form['fields']['description'] );
return $form;
},
1000
);