Skip to content

Instantly share code, notes, and snippets.

View hogash's full-sized avatar

Marius Horia hogash

View GitHub Profile
@hogash
hogash / parent-theme-mod-fallback.php
Created May 10, 2020 11:04 — forked from justintadlock/parent-theme-mod-fallback.php
Get theme mods that fall back to the stored parent theme mod if child theme is active.
<?php
/**
* The purpose of this code is to show how you can use theme mods that will fall back to
* the already-set mods of the parent theme. So, when a child theme is active, the code
* checks, in the following order: 1) child theme mod, 2) parent theme mod, 3) default.
*/
function jt_get_theme_mod( $name, $default = false ) {
if ( is_child_theme() )
@hogash
hogash / wp-query-ref.php
Created March 12, 2019 21:48 — forked from luetkemj/wp-query-ref.php
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@hogash
hogash / easing.js
Created February 7, 2019 11:22 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
// decelerating to zero velocity
@hogash
hogash / customizer-links.php
Created January 26, 2019 15:14 — forked from slushman/customizer-links.php
How to link into the WordPress Customizer
.border-right{ border-right: solid 0px #262626; }
@media (min-width: 768px){
.border-right{ border-right: solid 1px #262626; }
}
.border-right2{ border-right: solid 0px #ddd; }
@media (min-width: 768px){
.border-right2{ border-right: solid 1px #ddd; }
}
<?php
// Show Errors
error_reporting(E_ALL);
ini_set('display_errors', 1);
$file = 'http://kallyas.net';
$file = 'http://hogash.com';
// Carousel slider
if ($("#slider").length){
$(".slider").carouFredSel({
prev: '.btn-prev',
next: '.btn-next',
pagination: ".pagination",
items: {
visible: 3,
width: 300
},
// helper functions
function is_null(a) {
return (a === null);
}
function is_undefined(a) {
return (is_null(a) || typeof a == 'undefined' || a === '' || a === 'undefined');
}
function is_array(a) {
return (a instanceof Array);
@hogash
hogash / countcss.js
Created December 19, 2015 12:31
Count selectors CSS
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@hogash
hogash / Custom Code in Child theme
Last active October 8, 2015 08:25
Add this code inside functions.php in Kallyas Child theme
<?php
/* Add custom code in Body at the end */
add_action( 'zn_after_body', 'zn_custom_code_in_body_function',11 );
if ( !function_exists('zn_custom_code_in_body_function') ) {
function zn_custom_code_function(){
?>
<div> Custom Code here </div>
<?php
}