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:31
Add a custom item to the user account menu #hivepress #users
<?php
add_filter(
'hivepress/v1/menus/user_account',
function( $menu ) {
$menu['items']['custom_name_here'] = [
'label' => 'custom label here',
'url' => 'custom url here',
'_order' => 123,
];
@hivepress
hivepress / functions.php
Created April 26, 2022 16:13
Enable rich text (HTML) editor for the listing description #hivepress #listings
<?php
add_filter(
'hivepress/v1/models/listing',
function( $model ) {
$model['fields']['description']['editor'] = true;
return $model;
},
1000
);
@hivepress
hivepress / functions.php
Last active December 19, 2023 08:31
Hide the images field in the listing form #hivepress #listings
<?php
add_filter(
'hivepress/v1/forms/listing_update',
function( $form ) {
unset($form['fields']['images']);
return $form;
},
1000
);
@hivepress
hivepress / style.css
Created April 26, 2022 15:47
Hide the Add Listing (List a Service, List a Property) button #hivepress #listings
.hp-menu--site-header .hp-menu__item--listing-submit{
display: none;
}
@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
);
@hivepress
hivepress / functions.php
Created April 27, 2022 10:17
Add a custom checkbox to the user registration form #hivepress #users
<?php
add_filter(
'hivepress/v1/forms/user_register',
function( $form ) {
$form['fields']['custom_name_here'] = [
'caption' => 'custom text here',
'type' => 'checkbox',
'_order' => 123,
];
@hivepress
hivepress / functions.php
Created April 27, 2022 10:08
Add custom content to the listing search page sidebar #hivepress #templates
<?php
add_filter(
'hivepress/v1/templates/listings_view_page',
function( $template ) {
return hivepress()->helper->merge_trees(
$template,
[
'blocks' => [
'page_sidebar' => [
'blocks' => [
@hivepress
hivepress / functions.php
Created April 26, 2022 15:52
Make the purchase note or booking note required #hivepress #marketplace #bookings
<?php
add_filter(
'hivepress/v1/forms/listing_update',
function( $form ) {
if(isset($form['fields']['purchase_note'])){
$form['fields']['purchase_note']['required'] = true;
}
return $form;
},
@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 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;
},