Skip to content

Instantly share code, notes, and snippets.

View oneblackcrayon's full-sized avatar

Frederick Polk oneblackcrayon

View GitHub Profile
@oneblackcrayon
oneblackcrayon / functions.php
Created September 29, 2021 00:20 — forked from hmowais/functions.php
Google Page Speed [Manual-Updated]
/* cleaup*/
remove_action( 'wp_head', 'feed_links_extra', 3 ); // Display the links to the extra feeds such as category feeds
remove_action( 'wp_head', 'feed_links', 2 ); // Display the links to the general feeds: Post and Comment Feed
remove_action( 'wp_head', 'rsd_link' ); // Display the link to the Really Simple Discovery service endpoint, EditURI link
remove_action( 'wp_head', 'wlwmanifest_link' ); // Display the link to the Windows Live Writer manifest file.
remove_action( 'wp_head', 'index_rel_link' ); // index link
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 ); // prev link
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 ); // start link
remove_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 ); // Display relational links for the posts adjacent to the current post.
@oneblackcrayon
oneblackcrayon / wp-code-utils.php
Created September 29, 2021 00:20 — forked from josanua/wp-code-utils.php
wp code utils
<?php
// Debug
//Activate log files in wp-config.php
define( 'WP_DEBUG', true ); // Enabling WP_DEBUG will cause all PHP errors, notices and warnings to be displayed.
define( 'WP_DEBUG_LOG', true ); // Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_DISPLAY', true ); // Controls whether debug messages are shown inside the HTML of pages or not.
// use this
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );

Font Face

A mixin for writing @font-face rules in SASS.

Usage

Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);
@oneblackcrayon
oneblackcrayon / functions.php
Created September 29, 2021 00:13 — forked from abelsaad/functions.php
Content Excerpt Limit
<?php
function excerpt($limit) {
$excerpt = explode(' ', get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) {
array_pop($excerpt);
$excerpt = implode(" ",$excerpt).'...';
} else {
$excerpt = implode(" ",$excerpt);
}
@oneblackcrayon
oneblackcrayon / custom-search-acf-wordpress.php
Created August 9, 2021 04:01 — forked from charleslouis/custom-search-acf-wordpress.php
PHP - Wordpress - Search - wordpress custom search function that encompasses ACF/advanced custom fields and taxonomies and split expression before request
<?php
/**
* [list_searcheable_acf list all the custom fields we want to include in our search query]
* @return [array] [list of custom fields]
*/
function list_searcheable_acf(){
$list_searcheable_acf = array("title", "sub_title", "excerpt_short", "excerpt_long", "xyz", "myACF");
return $list_searcheable_acf;
}
@oneblackcrayon
oneblackcrayon / ffmpeg-conversion.sh
Last active June 27, 2021 02:21
FFMPEG conversion for DaVinci Resolve
# One off
ffmpeg -i input/filename.MOV -vcodec dnxhd -acodec pcm_s16le -s 1920x1080 -r 24000/1001 -b:v 36M -pix_fmt yuv422p -f mov output/filename.MOV
# Batch processing
for i in *.MP4; do ffmpeg -i "$i" -vcodec dnxhd -acodec pcm_s16le -s 1920x1080 -r 24000/1001 -b:v 36M -pix_fmt yuv422p -f mov output/\"${i%.*}.mp4\"; done
@oneblackcrayon
oneblackcrayon / image-handling-wordpress.php
Created December 12, 2020 03:00 — forked from thetwopct/image-handling-wordpress.php
WordPress image handling (ACF / Background Images / Inline / srcset /
//
<?php
if ( has_post_thumbnail() ) {
echo wp_get_attachment_image(get_post_thumbnail_id($post->ID), '', false, array('class' => 'featured-image'));
} else {
echo '<img src="' . get_bloginfo( 'stylesheet_directory' )
. '/library/images/thumbnail-default.jpg" alt="default thumb" class="featured-image"/>';
}
?>
@oneblackcrayon
oneblackcrayon / typekit-mixin.scss
Created July 3, 2020 06:37 — forked from DomenicoColandrea86/typekit-mixin.scss
Typekit Font Mixin for SCSS
Sass Mixin for typekit variation-specific font-family names
Typekit IE6-8 Support (http://help.typekit.com/customer/portal/articles/6855-Using-multiple-weights-and-styles)
$lucida-grande: "Lucida Grande", Tahoma, Verdana, Arial, sans-serif;
$georgia: Georgia, Cambria, "Times New Roman", Times, serif;
// Must include fallbacks for EACH typekit font — set them each as variables
//************************************************************************//
$typekit-fonts: "source-sans-pro", "ff-tisa-web-pro"; // index [1, 2]
@oneblackcrayon
oneblackcrayon / placeholder.scss
Created July 3, 2020 05:50 — forked from antsa/placeholder.scss
Placeholder mixin for Sass
// Placeholder @mixin for Sass
//
// A mixin to style placeholders in HTML5 form elements.
// Includes also a .placeholder class to be used with a polyfill e.g.
// https://github.com/mathiasbynens/jquery-placeholder
// Requires Sass 3.2.
//
// Example usage (.scss):
//
// input {
@oneblackcrayon
oneblackcrayon / php.ini
Created March 16, 2020 18:47 — forked from arbaouimehdi/php.ini
php.ini
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order: