Skip to content

Instantly share code, notes, and snippets.

View UraraReika's full-sized avatar
:octocat:

Oleksandr Rudyi UraraReika

:octocat:
View GitHub Profile
@UraraReika
UraraReika / jet-woo-builder-add-swiper-slider-options.php
Created October 1, 2020 12:01
Add whatever you want option to swiper slider.
<?php
add_filter( 'jet-woo-builder/tools/carousel/options', '__your_prefix_add_carousel_options' );
function __your_prefix_add_carousel_options( $options ) {
$options['freeMode'] = true;
return $options;
}
@UraraReika
UraraReika / jet-woo-builder-percentage-sale-min-max-discount-macros.php
Last active April 19, 2024 11:37
Add new macros to default jet-woo-builder macros list and assign a callback functions.
<?php
add_filter( 'jet-woo-builder/macros/macros-list', function( $macros ) {
$macros['percentage_sale_max'] = 'get_percentage_sale_max';
$macros['percentage_sale_min'] = 'get_percentage_sale_min';
return $macros;
} );
function get_percentage_sale_max() {
global $product;
@UraraReika
UraraReika / jet-engine-get-post-url-by-meta-value-callback.php
Created October 18, 2019 11:51
Get Post URL by meta value, function that returns a post URL that match the given meta value.
<?php
add_filter( 'jet-engine/listings/allowed-callbacks', '__your_prefix_get_post_url_by_post_meta_callback', 10, 2 );
function __your_prefix_get_post_url_by_post_meta_callback( $callbacks ) {
$callbacks['__your_prefix_post_meta_field_value'] = esc_html__( 'Post URL by Post Meta Value', 'jet-engine' );
return $callbacks;
}
function __your_prefix_post_meta_field_value( $meta_value ) {
global $wpdb;
@UraraReika
UraraReika / jet-elements-add-custom-meta-callback.php
Created October 11, 2019 06:04
Create Custom callback for Jet Posts Widgets that crops the transferred text to the specified number of words.
<?php
add_filter( 'jet-elements/posts/meta_callbacks', '__your_prefix_add_meta_callback' );
function __your_prefix_add_meta_callback( $callbacks ) {
$callbacks['__your_prefix_get_post_words_trim'] = esc_html__( 'Words Trim', 'jet-elements' );
return $callbacks;
}
function __your_prefix_get_post_words_trim( $content ) {
@UraraReika
UraraReika / jet-woo-builder-widgets-get-woo-placeholder-image.php
Last active May 19, 2022 19:27
Replace default Elementor image placeholder to Woocommerce Placeholder image
<?php
add_filter( 'jet-woo-builder/template-functions/placeholder-thumbnail-src', '__your_prefix_get_wc_placeholder_image' );
function __your_prefix_get_wc_placeholder_image() {
$placeholder = wc_placeholder_img_src( 'woocommerce_thumbnail' );
return $placeholder;
}
@UraraReika
UraraReika / taxonomy-tiles-display-custom-tax-featured-image.php
Last active October 9, 2019 12:32
Get custom taxonomy image and display it, as tile background of Jet Woo Taxonomy Tiles Widget
@UraraReika
UraraReika / taxonomy-tiles-expand-list-of-taxonomies.php
Last active September 27, 2019 14:41
Adds necessary taxonomies to the drop-down list of Jet Woo Taxonomy Tiles Widget
<?php
add_filter( 'jet-woo-builder/jet-woo-taxonomy-tiles/taxonomy_options', '__your_prefix_add_taxonomy_options' );
function __your_prefix_add_taxonomy_options( $taxonomy ) {
$taxonomy['category'] = esc_html__( 'Post Category', 'jet-woo-builder' ); // Standart Post Category key
$taxonomy['post-custom-tax'] = esc_html__( 'Custom Taxonomy', 'jet-woo-builder' ); // Custom Taxonomy key
return $taxonomy;
}
@UraraReika
UraraReika / jet-search-add-custom-meta-callback.php
Last active September 27, 2019 14:44
Return post titles from post IDs array as string with passed delimiter
<?php
add_filter( 'jet-search/ajax-search/meta_callbacks', '__your_prefix_add_meta_callback' );
function __your_prefix_add_meta_callback( $callbacks ) {
$callbacks['__your_prefix_get_post_title_by_id'] = esc_html__( 'Get post title by ID', 'jet-search' );
return $callbacks;
}
function __your_prefix_get_post_title_by_id( $value = null, $delimiter = ', ' ) {