Skip to content

Instantly share code, notes, and snippets.

Avatar

Md. Elias elias1435

View GitHub Profile
@elias1435
elias1435 / Initial Configurations
Created Sep 27, 2022
Elementor Popup once per session || Show after X Sessions Elementor
View Initial Configurations
# Create a Popup
1. Create a standard Elementor Popup
2. Set the Display Conditions for the pages you want to use it on
3. Take a note of the Popup ID
# JavaScript Code
1. In this example add an HTML Widget to the page
2. Copy and paste the code below into the Widget
3. Change the "popupId" constant you the ID of your
@elias1435
elias1435 / view-count-elementor-pro-cards-post-skin.php
Created Sep 12, 2022
by this code snippet can be add view count for element pro post widget. use this snippet to your child theme functions.php This snippet will only work for skin type "cards" you can change your just change the "cards" below
View view-count-elementor-pro-cards-post-skin.php
<?php
add_action( 'elementor/widget/posts/skins_init',function($widget) {
class change_meta_data extends \ElementorPro\Modules\Posts\Skins\Skin_Cards {
public function get_id() {
return 'cards';
}
public function get_title() {
return esc_html__( 'Card', 'elementor-pro' );
}
@elias1435
elias1435 / view-count-jet-block.php
Last active Sep 12, 2022
by this code snippet can be add view count for crocoblock jet block plugin. use this snippet to your child theme functions.php
View view-count-jet-block.php
<?php
add_filter( 'single_template', 'update_view_counter' );
function update_view_counter( $single_template ) {
global $post;
$old_count = get_post_meta( $post->ID, 'sk_view_counter', true );
update_post_meta($post->ID, 'sk_view_counter', ($old_count+1));
return $single_template;
}
@elias1435
elias1435 / Archive-product.php
Created Aug 16, 2022
Change your woocommerce Product listing with Grid and List view with jQuery
View Archive-product.php
<?php
/**
* The Template for displaying product archives, including the main shop page which is a post type archive
*
* This template can be overridden by copying it to yourtheme/woocommerce/archive-product.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@elias1435
elias1435 / functions.php
Created Jul 29, 2022
Elementor - SORT POSTS BASED ON A CUSTOM DATE FIELD
View functions.php
/* Sort Posts by Custom Date Field */
add_action( 'elementor/query/event_sort_date', function( $query ) {
$query->set( 'meta_key', 'event_date' );
$query->set( 'orderby', 'meta_value_num' );
$query->set( 'order', 'ASC' );
});
View Elementor Search Filter using SearchWP plugins Filter
<?php
// Customize SearchWP Engine used.
add_filter( 'searchwp\native\args', function( $args, $query ) {
$args['engine'] = 'supplemental';
return $args;
}, 15, 2 );