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 July 26, 2023 17:21
Change the price display format for bookable listings #hivepress #listings #bookings
<?php
add_filter(
'hivepress/v1/models/listing/fields',
function( $fields, $model ) {
if ( isset( $fields['price'] ) ) {
$fields['price']['display_template'] = '%value% / day';
}
return $fields;
},
@hivepress
hivepress / functions.php
Created July 23, 2022 23:24
Restrict email domains for newly registered users #hivepress #users
<?php
add_filter(
'hivepress/v1/forms/user_register/errors',
function( $errors, $form ) {
if ( ! $errors ) {
$domain = hivepress()->helper->get_last_array_value( explode( '@', $form->get_value( 'email' ) ) );
if ( ! in_array(
$domain,
[
@hivepress
hivepress / style.css
Created July 23, 2022 23:17
Adjust the HivePress page width and padding #hivepress #themes
.hp-page {
max-width: 1234px;
padding: 32px;
}
@hivepress
hivepress / functions.php
Created July 23, 2022 23:16
Add custom CSS class to the HivePress page wrapper #hivepress #themes
<?php
add_filter(
'hivepress/v1/blocks/page',
function( $args ) {
return hivepress()->helper->merge_arrays(
$args,
[
'attributes' => [
'class' => [ 'my-custom-wrapper' ],
],
@hivepress
hivepress / functions.php
Created July 23, 2022 23:16
Add custom HTML wrapper to HivePress pages #hivepress #themes
<?php
add_filter(
'hivepress/v1/blocks/page',
function( $args ) {
return hivepress()->helper->merge_arrays(
$args,
[
'blocks' => [
'before' => [
'type' => 'content',
@hivepress
hivepress / header.php
Created July 23, 2022 23:15
Render HivePress menu in a third-party theme #hivepress #themes
<?php
if ( function_exists( 'hivepress' ) ) {
echo hivepress()->template->render_menu();
}
@hivepress
hivepress / functions.php
Created July 23, 2022 23:14
Declare HivePress support in a third-party theme #hivepress #themes
<?php
add_action(
'after_setup_theme',
function() {
add_theme_support( 'hivepress' );
}
);
@hivepress
hivepress / functions.php
Created July 14, 2022 21:26
Hide the booking request field in the listing form #hivepress #bookings
<?php
add_filter(
'hivepress/v1/forms/listing_update',
function( $form ) {
unset( $form['fields']['booking_moderated'] );
return $form;
},
1000
);
@hivepress
hivepress / functions.php
Created June 17, 2022 20:28
Add description to the Profile Info field for users #hivepress #users
<?php
add_filter(
'hivepress/v1/forms/user_update',
function( $form ) {
if(isset($form['fields']['description'])){
$form['fields']['description']['description'] = 'custom text here';
}
return $form;
},
@hivepress
hivepress / functions.php
Created June 16, 2022 23:01
Hide the search form on the default listing categories page #hivepress #listings
<?php
add_filter(
'hivepress/v1/templates/listing_categories_view_page',
function( $template ) {
return hivepress()->helper->merge_trees(
$template,
[
'blocks' => [
'listing_search_form' => [
'type' => 'content',