Skip to content

Instantly share code, notes, and snippets.

View oneblackcrayon's full-sized avatar

Frederick Polk oneblackcrayon

View GitHub Profile
@oneblackcrayon
oneblackcrayon / widths.sass
Created January 4, 2022 23:26
Bulma CSS Framework Widths.
// Requires Bulma CSS Framework
// I have no idea where I found this file nor remember if I actually made it
// by extracting the code from the Grid>columns.sass file
// I believe it was a file in a previous release of Bulma called block.sass.
// If you know, please comment.
// Thanks.
@charset "utf8"
// Import the Bulma Mixins file
@import "../utilities/mixins"
// Utilities
@import "../../node_modules/bulma/sass/utilities/functions";
@import "../../node_modules/bulma/sass/utilities/derived-variables";
@import "../../node_modules/bulma/sass/utilities/mixins";
@import "../../node_modules/bulma/sass/utilities/controls";
// Base
@import "../../node_modules/bulma/sass/base/minireset";
@import "../../node_modules/bulma/sass/base/generic";

** WP - Optimizations and Cleanup **

Here you can find a a list of WP optimization and cleanup functions and methodology.

  1. .htaccess
  • Force https to your site.
  • Enable Browser Cache for your static files. This will fix the "Leverage Browser Caching" in the google pagespeed results.
  • Enable file compreassion for faster page load.
  1. wp-config.php
@oneblackcrayon
oneblackcrayon / functions.php
Created January 2, 2022 01:51 — forked from ellenbauer/functions.php
Aino functions.php with Custom Woo Login shortcodes
<?php
if ( ! function_exists( 'aino_setup' ) ) :
function aino_setup() {
// Adding support for featured images.
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 1800, 99999 );
// Adds custom image sizes.
add_image_size( 'aino-thumb', 1800, 1012, true ); // Image Ratio 16:9.
// completely disable image size threshold
add_filter( 'big_image_size_threshold', '__return_false' );
// increase the image size threshold to 3000px
function gc_big_image_size_threshold( $threshold ) {
return 3000; // new threshold
}
add_filter('big_image_size_threshold', 'gc_big_image_size_threshold', 999, 1);
<?php
/**
* For debug
* show template file name
* ---------------------------------------------------------*/
function show_template() {
global $template;
echo basename( $template );
}
@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);
}