Skip to content

Instantly share code, notes, and snippets.

@shirokoweb
shirokoweb / wp-config.php
Last active January 5, 2018 14:28
Setup custom path to wp-content folder in wp-config.php
$scheme = 'http';
// detect if we use HTTPS protocole
if ( isset( $_SERVER['HTTP_USER_AGENT_HTTPS'] ) && $_SERVER['HTTP_USER_AGENT_HTTPS'] == 'ON' ) {
$scheme = 'https';
}
// replace with subdomain name for static files
$static_folder_name = 'static';
@shirokoweb
shirokoweb / async-wpscripts
Last active January 11, 2018 11:17
async / defer wordpress scripts
function js_async_attr($tag){
# Do not add defer or async attribute to these scripts
$scripts_to_exclude = array('script1.js', 'script2.js', 'script3.js');
foreach($scripts_to_exclude as $exclude_script){
if(true == strpos($tag, $exclude_script ) )
return $tag;
}
# Defer or async all remaining scripts not excluded above
return str_replace( ' src', ' defer="defer" src', $tag );
WebFontConfig = {
google: {
families: [ 'Ubuntu:400' ]
},
timeout: 2000
};
@shirokoweb
shirokoweb / firethis.js
Created January 12, 2018 19:07
firethis script for owl carousel
jQuery(document).ready(function ($) {
$('.owl-carousel').owlCarousel({
navText:['\43','\44'],
dots: false,
loop: true,
nav: true,
lazyload: true,
margin: 50,
responsiveClass: true,
responsive: {
@shirokoweb
shirokoweb / owl.theme.default.css
Last active January 12, 2018 19:11
Custom css for owl carousel (to use ET fonts for arrows and placing them at the middle)
/**
* Owl Carousel v2.2.1
* Copyright 2013-2017 David Deutsch
* Licensed under ()
*/
/*
* Default theme - Owl Carousel CSS File
*/
@shirokoweb
shirokoweb / style.css
Created January 13, 2018 11:30
scribbler styling
.hero__terminal {
width: 60%;
margin: -11rem auto 3rem auto;
text-align: left;
color: white;
padding: 0 1rem;
border-radius: 4px;
background-color: #232323;
min-height: 285px;
animation: fadeUp 2s;
// utilities
var get = function (selector, scope) {
scope = scope ? scope : document;
return scope.querySelector(selector);
};
var getAll = function (selector, scope) {
scope = scope ? scope : document;
return scope.querySelectorAll(selector);
};
@shirokoweb
shirokoweb / functions.php
Last active January 29, 2018 10:51
starter setup for divi child theme
<?php
// Disable pingback.ping xmlrpc method to prevent Wordpress from participating in DDoS attacks
// remove x-pingback HTTP header
add_filter('wp_headers', function($headers) {
unset($headers['X-Pingback']);
return $headers;
});
// disable pingbacks
add_filter( 'xmlrpc_methods', function( $methods ) {
unset( $methods['pingback.ping'] );
@shirokoweb
shirokoweb / active.js
Created February 6, 2018 13:00
Add active
(function($) {
$(document).ready(function() {
var navChildren = $("#top-menu li").children();
var aArray = [];
for (var i = 0; i < navChildren.length; i++) {
var aChild = navChildren[i];
// var ahref = $(aChild).attr('href');
var ahrefTMP = $(aChild).attr('href');
var ahref = ahrefTMP.substring(ahrefTMP.indexOf('#'));
@shirokoweb
shirokoweb / footer.php
Created February 17, 2018 20:20
Load fonts async