Skip to content

Instantly share code, notes, and snippets.

View dnavarrojr's full-sized avatar

Dave Navarro, Jr. dnavarrojr

View GitHub Profile
@dnavarrojr
dnavarrojr / wp-body_class.php
Last active December 18, 2019 02:54
Attempt to add a CLASS to the BODY tag in WordPress, not working.
<?php
add_filter( 'body_class', function( $classes ) {
$restrict_page = ( get_field( 'msp_registration_required' ) ? true : false );
error_log( "before count = " . count( $classes ) );
if ( $restrict_page ) {
$classes[] = 'msp-restrict-page';
}
error_log( "after count = " . count( $classes ) );
return $classes;
} );
@dnavarrojr
dnavarrojr / ffprobe.sh
Last active October 28, 2022 09:33
Using FFPROBE to Create JSON files
#!/bin/bash
folder="/var/www/{website}/wp-content/uploads/video"
for filename in $folder/*.mov; do
if [ -f $filename ]; then
ffprobe -hide_banner -v quiet -print_format json -show_format -show_streams $filename > $folder/$(basename -s .mov $filename).json
fi
done
for filename in $folder/*.mp4; do
if [ -f $filename ]; then
ffprobe -hide_banner -v quiet -print_format json -show_format -show_streams $filename > $folder/$(basename -s .mp4 $filename).json
@dnavarrojr
dnavarrojr / acf_form_shortcode.php
Last active November 9, 2023 17:46
ACF Form Shortcode Plugin for the Front End
<?php
/*
Plugin Name: ACF Front End Forms
Plugin URI: https://navarrojr.com
Description: Create forms on the front end of the site from ACF field groups.
Version: 0.0.1
Author: Dave Navarro, Jr.
Author URI: https://navarrojr.com
*/