Skip to content

Instantly share code, notes, and snippets.

View nickpish's full-sized avatar

Nick Pishvanov nickpish

View GitHub Profile
@nickpish
nickpish / bnfw_update_personnel.php
Last active January 15, 2025 15:50
Function to update post meta for Personnel posts w/ BNFW plugin
<?php
function wes_update_personnel_notifications() {
// set args to query all Personnel posts
$args = array(
'post_type' => 'personnel',
'post_status' => 'any',
'posts_per_page' => -1,
);
$personnel_posts = get_posts( $args );
@nickpish
nickpish / add-label-to-fselect.php
Last active October 31, 2022 20:11
Add label element to fSelect facet markup
add_filter( 'facetwp_facet_html', function( $output, $params ) {
if ( 'fselect' == $params['facet']['type'] ) {
$label = '<label for="' . $params['facet']['name'] . '" class="sr-only">Please select a ' . $params['facet']['label'] . '</label>';
$output = $label . $output;
}
return $output;
}, 10, 2);
@nickpish
nickpish / facetwp-custom.php
Created August 18, 2022 02:30
FacetWP map facet: Get location from College taxonomy custom location field
add_filter( 'facetwp_index_row', function( $params, $class ) {
if ( 'college_map' == $params['facet_name'] ) {
$term_id = (int) $params['term_id'];
$location = get_term_meta( $term_id, 'location', true );
$params['facet_value'] = empty( $location ) ? '' : $location['lat'];
$params['facet_display_value'] = empty( $location ) ? '' : $location['lng'];
}
return $params;
}, 10, 2 );