This file contains hidden or 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
/* selects every element with an ID */ | |
[id] { | |
/* adds scroll margin to the top of an element when linked to */ | |
scroll-margin-top: 2rem; | |
} |
This file contains hidden or 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
<!-- From https://glitch.com/edit/#!/zesty-soybean?path=script.js%3A31%3A0 --> | |
<link rel="icon" href="<?php echo get_stylesheet_directory_uri(); ?>/path/to/favicon-light.png" | |
id="light-scheme-icon"> | |
<link rel="icon" href="<?php echo get_stylesheet_directory_uri(); ?>/path/to/favicon-dark.png" | |
id="dark-scheme-icon"> | |
<script> | |
function setupIcons() { | |
const lightSchemeIcon = document.querySelector('link#light-scheme-icon'); | |
const darkSchemeIcon = document.querySelector('link#dark-scheme-icon'); |
This file contains hidden or 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 | |
if ( 'page' === get_post_type() ) { | |
echo wp_trim_words( get_the_content(), 30, '...' ); | |
} else { | |
the_excerpt(); | |
} | |
// wp_trim_words() docs: https://developer.wordpress.org/reference/functions/wp_trim_words/ | |
?> |
This file contains hidden or 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 | |
function register_csg_patterns() { | |
} | |
add_action( 'init', 'register_csg_patterns' ); | |
function myBlockTemplate() { | |
$myBlockTemplate = get_post_type_object( 'myCustomPostType' ); // Adds these blocks to a specific post type | |
$myBlockTemplate->template = array( |
This file contains hidden or 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
// Add non-breaking space between the last 2 words of the elements selected | |
var noSpace = document.querySelectorAll(":is(h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, *:not(.keep-space)"); | |
for (var i = 0; i < noSpace.length; i++) { | |
var headline = noSpace[i].innerHTML; | |
// count the amount of spaces in the headline | |
var wordCount = headline.split(" ").length; | |
// if there are 3 spaces or more in the headline... | |
if (wordCount > 2) { | |
headline = headline.replace(/ (?=[^ ]*$)/i, " "); | |
} |
OlderNewer