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 16:00
Remove the Location field from the listing search form #hivepress #geolocation
<?php
add_filter(
'hivepress/v1/forms/listing_search',
function( $form ) {
unset($form['fields']['location']);
return $form;
},
1000
);
@hivepress
hivepress / style.css
Created April 26, 2022 16:02
Hide the listing category description #hivepress #listings
.hp-listing-category--view-block .hp-listing-category__description{
display: none;
}
@hivepress
hivepress / functions.php
Created April 26, 2022 16:05
Make first and last name fields required for users #hivepress #users
<?php
add_filter(
'hivepress/v1/forms/user_update',
function( $form ) {
$form['fields']['first_name']['required'] = true;
$form['fields']['last_name']['required'] = true;
return $form;
},
1000
@hivepress
hivepress / functions.php
Last active June 8, 2023 00:39
Make the profile image required for users #hivepress #users
<?php
add_filter(
'hivepress/v1/forms/user_update/errors',
function( $errors, $form ) {
$user = $form->get_model();
if ( $user && ! $user->get_image__id() ) {
$errors[] = 'Please upload the profile image.';
}
@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
Created April 26, 2022 16:16
Change the listing region URL slug (requires refreshing permalinks) #hivepress #geolocation
<?php
add_filter(
'hivepress/v1/taxonomies',
function( $taxonomies ) {
if(isset($taxonomies['listing_region'])){
$taxonomies['listing_region']['rewrite']['slug'] = 'custom-slug-here';
}
return $taxonomies;
},
@hivepress
hivepress / functions.php
Created April 26, 2022 16:17
Change the listing description position (order) on a page #hivepress #listings
<?php
add_filter(
'hivepress/v1/templates/listing_view_page',
function( $template ) {
return hivepress()->helper->merge_trees(
$template,
[
'blocks' => [
'listing_description' => [
'_order' => 123,
@hivepress
hivepress / style.css
Created April 26, 2022 16:21
Hide the listing publication date #hivepress #listings
.hp-listing--view-block .hp-listing__created-date,
.hp-listing--view-page .hp-listing__created-date {
display: none;
}
@hivepress
hivepress / style.css
Created April 26, 2022 16:22
Hide the vendor registration date #hivepress #vendors
.hp-vendor--view-block .hp-vendor__registered-date,
.hp-vendor--view-page .hp-vendor__registered-date {
display: none;
}
@hivepress
hivepress / style.css
Created April 26, 2022 16:32
Hide map on the listings search page #hivepress #listings
.hp-template--listings-view-page .hp-map {
display: none;
}