Skip to content

Instantly share code, notes, and snippets.

@Tusko
Tusko / func.php
Created Dec 6, 2018
Disable Wordperss Update to major 5.0 | Downgrade wordpress to 4.9.8
View func.php
<?php
add_filter('pre_site_option_update_core','wpdg_specific_version' );
add_filter('site_transient_update_core','wpdg_specific_version' );
function wpdg_specific_version($updates){
$sprache = get_locale().'/';
if ($sprache == 'en_US/' OR $sprache == 'en'){
$sprache = '';
};
$dg_version = '4.9.8';
@Tusko
Tusko / func.php
Created Oct 24, 2018
Set random dates for events ACF/WP
View func.php
<?php
$allevents = wp_get_recent_posts(array(
'showposts' => '-1',
'post_type' => 'events'
));
$start = strtotime("10 October 2018");
//End point of our date range.
$end = strtotime("22 November 2020");
@Tusko
Tusko / dom-helper.js
Created Oct 16, 2018 — forked from LasMD/dom-helper.js
Mini jQuery, sort of.
View dom-helper.js
/**
* A collection of helper prototype for everyday DOM traversal, manipulation,
* and event binding. Sort of a minimalist jQuery, mainly for demonstration
* purposes. MIT @ m3g4p0p
*/
window.$ = (function (undefined) {
/**
* Duration constants
* @type {Object}
View acf-cpt-custom.php
<?php
function ex_project_archive_options($cptmenu) {
$cptmenu['page_title'] = 'Projects Archive';
$cptmenu['menu_title'] = 'Projects Archive';
$cptmenu['slug'] = 'my-projects-archive';
return $cptmenu;
}
add_filter('cpt_project_acf_page_args', 'ex_project_archive_options');
/*
@Tusko
Tusko / style_basic.css
Created Jun 7, 2018
Wordpress Taxonomy Tree
View style_basic.css
.is-current-cat {
color: red !important
}
.cat-parent > li > ul {
padding-left: 20px;
display: none
}
.cat-parent > li > .is-current-cat + ul {
display: block
}
@Tusko
Tusko / gallery.php
Created Mar 19, 2018
Horizontal swiper gallery like masonry
View gallery.php
@Tusko
Tusko / selectric.woo.js
Created Feb 27, 2018
woocommerce + selectrict.js
View selectric.woo.js
$(document).ajaxComplete(function(){
$('.selectric-wrapper').each(function () {
var t = $(this),
s = $('select', t),
Selectric = s.data('selectric');
if($('input.input-text', t).length > 0) {
$('input.input-text', t).clone().appendTo('#billing_state_field');
t.remove();
}
if(typeof Selectric !== 'undefined') {
@Tusko
Tusko / closest.js
Created Feb 14, 2018
ClosestWord.js
View closest.js
var threshold = 3;
function distancer(s1, s2) {
// sift3: http://siderite.blogspot.com/2007/04/super-fast-and-accurate-string-distance.html
if (s1 == null || s1.length === 0) {
if (s2 == null || s2.length === 0) {
return 0;
} else {
return s2.length;
}
@Tusko
Tusko / init.js
Created Jan 23, 2018
Sync Swiper + Fancybox
View init.js
$('.mod-fmslider').each(function(i){
var t = this;
setTimeout(function(){
window.FMSlider[i] = new Swiper( t, {
navigation: {
nextEl : $('.swiper-btn-prev', t)[0],
prevEl : $('.swiper-btn-next', t)[0]
},
slidesPerView : 'auto',
freeModeSticky : true,
@Tusko
Tusko / parse.php
Last active Dec 2, 2017
Parse CSV by line (acf repeater)
View parse.php
<?php
$file = file_get_contents('/wp-content/themes/themename/analyzers.csv');
$lines = explode(PHP_EOL, $file);
$array = array();
foreach ($lines as $line) {
$l = str_getcsv($line);
$array[] = array(
'brand' => $l[1],
'model' => $l[0],
);
You can’t perform that action at this time.