Archives: Snippets
Add CPTs for Typesense
function cm_typesense_add_available_post_types( $available_post_types ) { //Edit, delete or add according to your information $available_post_types[‘docs’] = [ ‘label’ => ‘Documentation’, ‘value’ => ‘docs’ ]; $available_post_types[‘actualites’] = [ ‘label’ => ‘Actualités’, ‘value’ => ‘actualites’ ]; $available_post_types[‘notes_versions’] = [ ‘label’ => ‘Notes de…Continue reading
Hide unnecessary roles
add_filter( ‘editable_roles’, function( $roles ) { if (!current_user_can(‘administrator’) && !is_admin()) { unset( $roles[‘administrator’] ); } unset( $roles[‘editor’] ); unset( $roles[‘subscriber’] ); unset( $roles[‘revisor’] ); unset( $roles[‘docspress_manager’] ); unset( $roles[‘author’] ); unset( $roles[‘contributor’] ); return $roles; } );Continue reading
Tweak Price Display (Adjusts the Prices) | Display Eventbrite Events
add_filter( ‘wfea_price_display’, function ( $price_display, $min, $max, $currency ) { $event_id= get_post()->ID; if ( $event_id == 1234 ) { $min = $min – 10; $max = $max – 10; } if ( $min == $max ) { $price_display = $min;…Continue reading
Tweak Price Display (Appends Text) | Display Eventbrite Events
add_filter( ‘wfea_price_display’, function ( $price_display, $min, $max, $currency ) { return $price_display . ‘ (Discounts available at checkout)’; }, 10, 4 );Continue reading
Allow Eventbrite Styles in Long Description | Display Eventbrite Events
add_filter( ‘wfea_strip_eb_inline_styles’, ‘__return_false’ );Continue reading
Adjust Currency Symbols | Display Eventbrite Events
add_filter(‘wfea_currency_symbols’, function ($currency_symbols) { $currency_symbols[‘CAD’] = ‘CAD$’; return $currency_symbols; } );Continue reading
Filter Music Promoter Age Restriction | Display Eventbrite Events
add_filter( ‘wfea_age_restriction’, function ( $output, $age ) { if ( ‘all_ages’ === $age ) { $output = ‘All ages’; } return $output; }, 10, // filter priority 2 // number of args to filter );Continue reading
Filter the Event Title | Display Eventbrite Events
add_filter( ‘the_title’, function ( $title) { $post = get_post(); if ( ! property_exists( $post, ‘eb_url’ ) ) { return $title; } return ‘‘ . esc_attr( $post->organizer->name ) . ‘: ‘ . $title; }, 999, 1 );Continue reading
Remove Unwanted Events | Display Eventbrite Events
add_filter( ‘wfea_api_results’, function ( $events ) { // remove a specific organiser id $organiser_id = 123456789; $events = array_filter( $events, function ( $event ) use ( $organiser_id ) { return $event->organizer->id != $organiser_id; } ); return $events; }, 1000, 1…Continue reading