Skip to content

Instantly share code, notes, and snippets.

bacoords / shortcode-javascript.php
Last active Jun 10, 2021
how to enqueue js for a shortcode
View shortcode-javascript.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 / 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

Underscores Tutorial | 2.25.2021


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.
bacoords / public-listener-example.js
Last active Oct 23, 2020
Setting up function for 'onload' more properly
View public-listener-example.js
function addClickEvents() {
//events added here to ensure all image elements fully loaded prior to adding events"#poster-image") //Extinction Rebellion
.on("mouseover", function() { showExcerpt("xr", 450, 125, "R", 500, 500, boxText); })
.on("mouseout", function() {hideExcerpt("xr");})
.on("click", showContrib);"#blockUpperText3") //Robin Wall Kimmerer
bacoords / replace-images.js
Created Oct 13, 2020
public - function to load large images
View replace-images.js
// Function to background load images and swap out their source.
function replaceImageSrc() {
jQuery('svg image').each(function(){
var el = jQuery(this);
// Get the new href.
var href = el.attr('xlink:href');
href = href.replace( 'assets_small', 'assets_large' );
href = href.replace( '-s.', '-l.' );
View video cats.html
<ion-list *ngIf="(videoCategories$ | async) as categories" class="ion-padding-start">
<ion-item (click)="getSelectedCategoryVideos('2380')">
Therapeutic Breakout Sessions
<ion-item (click)="getSelectedCategoryVideos('2374')">
Online Breakout Sessions
<ion-item *ngFor="let category of categories" (click)="getSelectedCategoryVideos(">
{{ }}
View c3-live-redirect.php
if (
( $_SERVER['HTTP_HOST'] == '' )
) {
$newurl = '';
header('HTTP/1.0 301 Moved Permanently');
header("Location: $newurl");
View canonical-functions.php
* Removes any test urls from Yoast links.
* @param [type] $link
* @return void
function c3_fix_yoast_canonical_items( $link ) {
return str_replace(
bacoords / wp.jquery.default.js
Created Jul 2, 2019
Just a default wrapper
View wp.jquery.default.js
(function($) {
// Any generic functions can go here...
// Anything that needs to wait for the document to be ready goes here
bacoords / scrub-smart-quotes.php
Created Feb 21, 2019
Replaces smart quotes with quotation marks when adding shortcodes to WordPress content
View scrub-smart-quotes.php
* Scrubs content for curly quotes
* @param string $content
* @return string
function prefix_scrub_smart_quotes_from_shortcodes( $content ){
// Search for all smartquotes inside of shortcodes and replace them
$content = preg_replace('/(“|”)(?=[^\[]*\])/', '"', $content );