Skip to content

Instantly share code, notes, and snippets.

View kaskad88's full-sized avatar

Dmytro Bartoshchak kaskad88

  • Ukraine
View GitHub Profile
add_filter( 'jet-engine/listings/filters-list', function( $list ) {
$list['posts_list_by_ids'] = array(
'cb' => '__custom_posts_list_by_ids',
'args' => false,
);
return $list;
} );
add_filter( 'the_posts', '__search_by_sku' );
function __search_by_sku( $posts ) {
if ( is_admin() || ! is_search() ) {
return $posts;
}
$ignoreIds = array( 0 );
foreach ( $posts as $post ) {
add_action( 'init', function () {
global $wp_scripts;
$script = $wp_scripts->query( 'imagesloaded', 'registered' );
if ( ! $script ) {
return;
}
if ( ! in_array( 'jquery', $script->deps ) ) {
function cf_search_join( $join ) {
if ( is_admin() || ! is_search() ) {
return $join;
}
global $wpdb;
$join .= " LEFT JOIN {$wpdb->postmeta} ON {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id ";
add_filter( 'jet-engine/listing/grid/posts-query-args', function ( $args ) {
if ( in_array( 'tribe_events', $args['post_type'] ) ) {
$args['suppress_filters'] = true;
}
return $args;
} );
/**
* Adding custom icon to icon control in Elementor
*/
function jet_add_custom_icons_tab( $tabs = array() ) {
// Append new icons
$new_icons = array(
'account',
'airplane',
'wordpress',
@kaskad88
kaskad88 / HDquiz & JetPopup compatibility
Last active November 4, 2019 14:54
HDquiz & JetPopup compatibility
add_action( 'elementor/widget/before_render_content', function( $widget ) {
if ( 'shortcode' !== $widget->get_name() ) {
return;
}
if ( false === strpos( $widget->get_settings_for_display( 'shortcode' ), '[HDquiz quiz' ) ) {
return;
}
add_filter( 'wp_dropdown_cats', 'remove_spacing_wp_dropdown_cats', 10, 2 );
function remove_spacing_wp_dropdown_cats( $output, $args ) {
if ( $args['name'] === 'jet_ajax_search_categories' ) {
$output = str_replace( ' ', '', $output );
}
return $output;
}
@kaskad88
kaskad88 / Create alt date post meta ( timestamp )
Last active August 30, 2019 10:34
Create alt date post meta ( timestamp )
add_action( 'save_post_event', '__your_prefix__save_event_start_date_timestamp', 10, 3 );
function __your_prefix__save_event_start_date_timestamp( $post_id, $post, $update ) {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
$event_start_date = $_POST[ 'event_start_date' ];
@kaskad88
kaskad88 / JetMenu + Elementor NavMenu
Created June 14, 2019 08:05
Add an active class for a top-level menu item
(function($) {
$( '.jet-sub-mega-menu .current-menu-item' ).each( function() {
var $this = $( this );
$this.closest( '.jet-mega-menu-item' ).addClass( 'jet-current-menu-item' );
} );
}(jQuery));