Skip to content

Instantly share code, notes, and snippets.

View kaskad88's full-sized avatar

Dmytro Bartoshchak kaskad88

  • Ukraine
View GitHub Profile
function kursnbu( date ) {
if ( ! date ) {
return 0;
}
var apiUrl = 'https://bank.gov.ua/NBUStatService/v1/statdirectory/exchange?valcode=USD&date=',
dateApiFormat = Utilities.formatDate(date, "GMT+3", "yyyyMMdd"),
url = apiUrl + dateApiFormat + '&json',
response = UrlFetchApp.fetch( url ),
@kaskad88
kaskad88 / elementor font hook
Last active October 6, 2017 15:30 — forked from merianos/functions.php
Elementor custom fonts in font control
/**
* Responsible to modify the fonts list in the font control.
*/
function modify_controls( $controls_registry ) {
// First we get the fonts setting of the font control
$fonts = $controls_registry->get_control( 'font' )->get_settings( 'fonts' );
// Then we append the custom font family in the list of the fonts we retrieved in the previous step
$new_fonts = array_merge( [ 'Custom Font Family Name' => 'system' ], $fonts );
// Then we set a new list of fonts as the fonts setting of the font control
$controls_registry->get_control( 'font' )->set_settings( 'fonts', $new_fonts );
@kaskad88
kaskad88 / Cherry post formats api filter.txt
Last active October 1, 2018 15:02
Cherry post formats api
add_filter( 'shortcode_atts_gallery', '__tm_modify_shortcode_atts_gallery', 10, 4 );
function __tm_modify_shortcode_atts_gallery ( $out, $pairs, $atts, $shortcode ) {
$cherry_post_formats_api_args = __prifix_theme()->get_core()->modules['cherry-post-formats-api']->args;
if ( $cherry_post_formats_api_args['rewrite_default_gallery'] ) {
$out['link'] = $cherry_post_formats_api_args['gallery_args']['link'];
}
"Project-Id-Version: Jet Elements for Elementor\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-01 17:56+0300\n"
"PO-Revision-Date: 2018-08-29 14:14+0200\n"
"Last-Translator: \n"
"Language-Team: JetImpex\n"
"Language: en_US\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
add_filter( 'jet-engine/listings/macros-list', '__your_prefix_add_jet_engine_new_marcos' );
function __your_prefix_add_jet_engine_new_marcos( $list ) {
$list['current_year'] = '__your_prefix_jet_engine_current_year_cb';
return $list;
}
function __your_prefix_jet_engine_current_year_cb() {
return mktime( 0, 0, 0, 1 , 1, date('Y') );
add_filter( 'jet-engine/listings/macros-list', '__your_prefix_add_jet_engine_new_marcos' );
function __your_prefix_add_jet_engine_new_marcos( $list ) {
$list['current_day'] = '__your_prefix_jet_engine_current_day_cb';
return $list;
}
function __your_prefix_jet_engine_current_day_cb() {
return mktime( 0, 0, 0, date( 'n' ), date( 'j' ), date( 'Y' ) );
@kaskad88
kaskad88 / Update elementor control
Last active September 28, 2020 15:00
Update elementor control
add_action( 'elementor/element/jet-listing-grid/section_general/before_section_end', '__your_prefix_update_posts_num_control', 10, 2 );
function __your_prefix_update_posts_num_control( $widget = null, $args = array() ) {
$widget->update_control(
'posts_num',
array(
'max' => 1000,
)
);
}
@kaskad88
kaskad88 / Modify navigation_markup_template
Created April 19, 2019 11:58
Modify navigation_markup_template
add_filter( 'navigation_markup_template', '__your_prefix_modify_navigation_markup_template' );
function __your_prefix_modify_navigation_markup_template() {
$template = '
<nav class="navigation %1$s" role="navigation">
<div class="nav-links">%3$s</div>
</nav>';
return $template;
}
add_filter( 'jet-search/ajax-search/custom-post-data', '__your_prefix_add_custom_result_data', 10, 3 );
function __your_prefix_add_custom_result_data( $post_data, $data, $post ) {
$custom_meta_value = get_post_meta( $post->ID, 'custom_post_meta', true );
$post_data['custom'] = $custom_meta_value ? sprintf( '<div class="jet-ajax-search__custom-meta">%s</div>', $custom_meta_value ) : '';
return $post_data;
}
@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));