Skip to content

Instantly share code, notes, and snippets.

View Chrico's full-sized avatar

Christian Leucht Chrico

View GitHub Profile
@Chrico
Chrico / Change filemode of woff or ttf files
Created February 23, 2017 07:41
Sometimes font files are saved with the wrong embedding mode which will lead in Internet Explorer to following messag ein browser console: "CSS3114: @font-face failed OpenType embedding permission check. Permission must be Installable." and failing to load the font file. Just run this function below on your .ttf/.woff files which are listed in b…
<?php
function convertRestrictedFont($filename) {
$font = fopen($filename,'r+');
if ($font === false) {
throw new Exception('Could not open font file.');
}
fseek($font, 12, 0);
while (!feof($font)) {
@Chrico
Chrico / controller.php
Last active August 29, 2015 14:21
ContactForm7
<?php
/**
* getting the Script and Style suffix
* Adds a conditional ".min" suffix to the file name when SCRIPT_DEBUG is NOT set to TRUE.
*
* @return String $suffix
*/
function wpcf7_get_script_suffix(){
return defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
@Chrico
Chrico / chrico_get_popular_tags_by_category.php
Last active August 29, 2015 14:03
WordPress Dropin: Getting popular Tags by Category
@Chrico
Chrico / chrico_filter_comments_clauses_get_comments_last_week.php
Last active December 26, 2015 23:49
Comment Filter to fetch comments from last week with new WP_Date_Query()
<?php
/**
* adding a date-filter to the comment_query to fetch comments from last week
*
* @param Array $clauses
* @return Array $clauses
*/
function chrico_filter_comments_clauses_get_comments_last_week( $clauses ){
$last_week = gmdate( 'W' ) - 1;
$query_args = array(