This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Loads fonts asynchronously | |
* | |
* NOTE: needs love. | |
* | |
* @link https://github.com/filamentgroup/woff2-feature-test/blob/master/woff2.js | |
* @link http://bdadam.com/blog/loading-webfonts-with-high-performance.html | |
*/ | |
'use strict'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; EditorConfig is awesome: http://EditorConfig.org | |
# editorconfig.org | |
root = true | |
[*] | |
indent_style = space | |
indent_size = 4 | |
end_of_line = lf | |
charset = utf-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env: | |
browser: true | |
rules: | |
brace-style: [2, "stroustrup", { "allowSingleLine": true }] | |
comma-style: [2, "last"] | |
default-case: 2 | |
# func-style: [2, "expression"] | |
guard-for-in: 2 | |
indent: [2, 4, {"SwitchCase": 1}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Check if a a page is child of a given ID | |
* | |
* @link(_blank, http://bavotasan.com/2011/is_child-conditional-function-for-wordpress/) | |
* @param int $page_id The parent page id to check | |
* @return bool | |
*/ | |
function n26_is_child($page_id) { | |
global $post; | |
if (is_page() && ($post->post_parent == $page_id)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Put some nice content into a description meta tag | |
* | |
* Usage: | |
* <meta name="description" content="<?php echo ud_site_desc(); ?>"> | |
* | |
* @return string 200 characters long descrption tag | |
*/ | |
function ud_site_desc() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Prepend a namespace in WordPress body_class() function | |
* @param string $prefix The desired prefix | |
* @param string $classes Additional classes separated by single space | |
* @return string Single space separated list of classes | |
*/ | |
function body_class_prefix($prefix, $classes = '') | |
{ | |
global $wp_query; | |
$output = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$string = trim(preg_replace('/\s+/', ' ', $string)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Adds a custom class to excerpt `p` tah | |
* @param string $class The wanted new class | |
* @return string `p` tag with a class and the content of the excerpt | |
*/ | |
function cm_excerpt($class) | |
{ | |
$excerpt = strip_tags(get_the_excerpt()); | |
echo '<p class="' . $class . '">' . $excerpt . '</p>'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Prints out array in human readable form, just a helper function | |
* @param array $arr The wanted array to be printed | |
* @return array The array in human readable form | |
*/ | |
function printr_func($arr) | |
{ | |
echo "<pre class='printr'><code>"; | |
print_r($arr); | |
echo "</code></pre>"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get SVG file as raw SVG, not img tag | |
* @param string $path Path to images direcotry | |
* @param string $file The filename, file extension (.svg) can be omitted | |
* @return string The contents of the wanted SVG file | |
*/ | |
function cm_svg_get($path = 'images', $file = '') | |
{ | |
// $file = $file.".svg"; | |
$svg = ".svg"; |