Skip to content

Instantly share code, notes, and snippets.

View MjHead's full-sized avatar

Andrew Shevchenko MjHead

  • Crocoblock
  • Ukraine
View GitHub Profile
add_filter( 'shortcode_atts_vc_btn', '__tm_vc_button_macros', 10, 3 );
function __tm_vc_button_macros( $out, $pairs, $atts ) {
if ( ! isset( $out['link'] ) ) {
return $out;
}
$link = $out['link'];
if ( false === strpos( $link, '__home_url__' ) ) {
function doubleClickMenu( $jqEvent ) {
var $parentNode = $( this ),
$menuToggle = $parentNode.closest( '.menu' ).prev( '.menu-toggle' ),
menuIndex = $parentNode.index();
if ( 'inline-block' !== $menuToggle.css( 'display' ) ) {
if ( menuIndex !== parseInt( $parentNode.data( 'index' ), 10 ) ) {
$jqEvent.preventDefault();
<?php
add_filter( 'mc-listings/templates/filters/item-classes', '__prefix_add_classes' );
function __prefix_add_classes( $classes = array() ) {
$classes['new-class'] = 'true';
return $classes;
}
add_filter( 'woocommerce_get_plugins_for_woocommerce', '_tm_clear_woo_plugins', 10, 2 );
function _tm_clear_woo_plugins( $woo_plugins, $all_plugins ) {
$allowed_plugins = array(
'tm-woocommerce-package/tm-woocommerce-package.php' => true,
'tm-woocommerce-quick-view/tm-woocommerce-quick-view.php' => true,
'tm-woocommerce-ajax-filters/tm-woocommerce-ajax-filters.php' => true,
'tm-woocommerce-compare-wishlist/tm-woocommerce-compare-wishlist.php' => true,
'woocommerce-currency-switcher/index.php' => true,
'woocommerce-social-media-share-buttons/index.php' => true,
jQuery( document ).ready( function ( $ ) {
function initCarouselThumbnail() {
$( '.woocommerce-product-gallery__trigger' ).prependTo(".woocommerce-product-gallery > .flex-viewport");
$( 'ol.flex-control-nav' ).wrap("<div class='thumbnails-slider'></div>").addClass('slides');
var sliderWrap = $('.thumbnails-slider'),
productGallery = $('.woocommerce-product-gallery'),
sliderItems = $('.slider-thumbnails > li'),
@MjHead
MjHead / hooks.php
Created November 15, 2017 11:41
Remove theme from updates list
add_filter( 'site_transient_update_themes', 'probit_disable_update_notice' );
function probit_disable_update_notice( $updates_transient ) {
$updates = $updates_transient->response;
$current_theme = get_option( 'template' );
if ( isset( $updates[ $current_theme ] ) ) {
unset( $updates[ $current_theme ] );
}
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="manifest" href="site.webmanifest">
( function( $ ) {
"use strict";
var myElementorFront = {
init: function() {
elementorFrontend.hooks.addAction( 'frontend/element_ready/wp-widget-my_widget.default', myElementorFront.initWidget );
},
@MjHead
MjHead / icons.php
Created February 16, 2018 09:35
Adding custom icon to icon control in Elementor
<?php
/**
* Adding custom icon to icon control in Elementor
*/
function jet_modify_controls( $controls_registry ) {
// Get existing icons
$icons = $controls_registry->get_control( 'icon' )->get_settings( 'options' );
// Append new icons