Skip to content

Instantly share code, notes, and snippets.

@bacoords
bacoords / jquery-wrapper.js
Last active Feb 14, 2022
My default wrapper when using jQuery in WordPress
View jquery-wrapper.js
(function($) {
$(document).ready(function($){
});
})( jQuery );
@bacoords
bacoords / snippet.json
Created Feb 14, 2022
VSCode snippet for a simple jQuery wrapper
View snippet.json
{
"JQuery Frame": {
"prefix": "wpjquery",
"body": [
"(function($) {",
"",
"\t$(document).ready(function($){",
"",
"\t\t$1",
"",
@bacoords
bacoords / understrap-post-nav.php
Created Jan 19, 2022
Replace Understrap post nav font-awesome reference with inline Bootstrap Icons SVGs
View understrap-post-nav.php
<?php
/**
* Display navigation to next/previous post when applicable.
*/
function understrap_post_nav() {
// Don't print empty markup if there's nowhere to navigate.
$previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
$next = get_adjacent_post( false, '', false );
if ( ! $next && ! $previous ) {
return;
@bacoords
bacoords / content-card.php
Created Jan 15, 2022
Understrap post content with card classes
View content-card.php
<?php
/**
* Post rendering content according to caller of get_template_part
*
* @package Understrap
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
?>
@bacoords
bacoords / archive.php
Created Jan 15, 2022
Understrap archive with columns layout
View archive.php
<?php
/**
* The template for displaying archive pages
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package Understrap
*/
// Exit if accessed directly.
@bacoords
bacoords / custom-javascript.js
Created Jan 11, 2022
Understrap - how to use bootstrap components
View custom-javascript.js
// Add your custom JS here.
import Popover from 'bootstrap/js/dist/popover'
var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'))
var popoverList = popoverTriggerList.map(function (popoverTriggerEl) {
return new Popover(popoverTriggerEl)
@bacoords
bacoords / functions.php
Created Oct 20, 2021
Remove lazy loading from WordPress custom logo
View functions.php
<?php
function understrap_get_custom_logo_attributes( $custom_logo_attr ){
$custom_logo_attr['data-no-lazy'] = '1';
$custom_logo_attr['loading'] = 'eager';
return $custom_logo_attr;
}
add_filter( 'get_custom_logo_image_attributes', 'understrap_get_custom_logo_attributes' );
@bacoords
bacoords / shortcode-javascript.php
Last active Jun 10, 2021
how to enqueue js for a shortcode
View shortcode-javascript.php
<?php
/**
* Our theme/plugin enqueue scripts function.
*/
function example_enqueue_scripts() {
// Register the script in the normal WordPress way.
wp_register_script( 'example-shortcode-js', '...example-shortcode-script.js' );
@bacoords
bacoords / understrap-child-allow-dropdown-links.php
Created Mar 18, 2021
All dropdown to be links when using the bootstrap nav walked or under strap theme.
View understrap-child-allow-dropdown-links.php
View underscores-tutorial.md

Underscores Tutorial

howarddc.com | 2.25.2021

Tutorial

Dev Prereqs

The first step is to confirm that your machine is ready for development using Node, NPM, and Gulp.

  • NVM: Node Version Manager can be confirmed by running command -v nvm.
  • Gulp CLI should be installed globally via npm install --global gulp-cli. You can confirm it by running gulp --version.