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
/** | |
* Include this Sass mixin for aspect-ratio. Includes fallback | |
* for browsers that do not support aspect-ratio. This fallback is really not necessary at this point unless | |
* a specific browser you need to support. | |
* | |
* Usage: | |
* @include aspect-ratio(16,9); | |
* creates a 16x9 container using aspect-ratio for supported browsers with fallback for browsers that do not. | |
* | |
* Codepen Example: https://codepen.io/knolaust/pen/KKZwXjv |
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
<?php | |
/** | |
* Limit MCE WYSIWYG Colors | |
* | |
* This function overrides TinyMCE's default color options in the WordPress Classic Editor Block | |
* or ACF (Advanced Custom Fields) WYSIWYG editor. It limits the available color choices. | |
* | |
* Gist Keywords: wordpress, editor, admin, tinymce, colors | |
* Author: Knol Aust | |
* Version: 1.0.0 |
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
<?php | |
/** | |
* Hide Content Editors on Specific Pages | |
* | |
* This function hides the content editor on specific pages in the WordPress admin panel. | |
* It checks the current page and removes the editor for pages with specific titles. | |
* | |
* Gist Keywords: wordpress, editor, acf, content | |
* Author: Knol Aust | |
* Version: 1.0.0 |
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
<?php | |
/** | |
* Add Options Page for Custom Post Type and ACF | |
* | |
* Adds an "options" page for a custom post type and Advanced Custom Fields (ACF). | |
* It allows you to define custom options specific to the post type. | |
* | |
* Gist Keywords: wordpress, acf, cpt, custom post type, options | |
* Author: Knol Aust | |
*/ |
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
<!-- | |
To get the OSM ID for a county or municipality: | |
1. Go to https://nominatim.openstreetmap.org/ui/search.html | |
2. Search for the county or municipality. | |
3. Click on "Details" and scroll to the OSM ID. Copy it. | |
4. Go to http://polygons.openstreetmap.fr/index.py and paste the OSM ID. | |
5. Copy the coordinates and remove unnecessary array wrappers. | |
Author: Knol Aust | |
Gist Keywords: google, maps, js, javascript, css | |
--> |
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
<?php | |
/** | |
* Enable GZIP compression for HTML, CSS, JavaScript, Text, XML, and fonts. | |
* | |
* This code snippet configures the server to enable GZIP compression for various file types, | |
* including HTML, CSS, JavaScript, Text, XML, and font files. It also includes rules to handle | |
* browser compatibility issues. | |
* | |
* Gist Keywords: wordpress, gzip, server optimization, speed, compression | |
* |
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
<?php | |
/** | |
* Hide Contact Form 7 reCAPTCHA on non-contact pages. | |
* | |
* This function removes the enqueuing of Contact Form 7's reCAPTCHA scripts | |
* on pages that don't contain the Contact Form 7 shortcode. It helps optimize | |
* website performance by only loading necessary scripts when needed. | |
* | |
* Gist Keywords: wordpress, recaptcha, cf7, contact gorm 7, performance | |
* |
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
<?php | |
/** | |
* Output Advanced Custom Fields Data as JSON in JavaScript Console. | |
* | |
* This code retrieves data from Advanced Custom Fields (ACF) and outputs it | |
* as JSON in the JavaScript console for debugging and development purposes. | |
* | |
* Gist Keywords: wordpress, acf, javascript, debugging | |
* | |
* @author Knol Aust |
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
/** | |
* JavaScript Request with Error Handling | |
* Author: Knol Aust | |
* Gist Keywords: js, javascript, http request, error handling | |
* Description: This code checks for the existence of an HTML element with the id "elem" and makes an XMLHttpRequest to an API or endpoint. | |
* It handles both successful responses and errors by providing comments and suggestions. | |
*/ | |
// Check if the element with id "elem" exists in the page | |
if (document.getElementById("elem")) { |
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
<?php | |
/** | |
* Disable Unnecessary Generated Image Sizes | |
* Author: Knol Aust | |
* Gist Keywords: wordpress, media library, images, image sizes | |
* Description: WordPress automatically generates multiple image sizes upon upload. This code disables unnecessary standard image sizes to reduce server/CDN bloat. Regenerate images after implementing. | |
*/ | |
/** | |
* Disable generated image sizes. |