Skip to content

Instantly share code, notes, and snippets.

View kevinwhoffman's full-sized avatar

Kevin W. Hoffman kevinwhoffman

View GitHub Profile
/*
- I have a CPT named Galleries and within this CPT there are 6 individual galleries, all using the same format.
- I have used the Enhanced Media Library plugin to allow a category(ies) to be added each image uploaded.
- single-galleries.php - is a template used for displaying each of these individual galleries.
- Each individual gallery has aprox 4 categories in use that are assigned to the different images.
- There are aprox 24 categories for all of the images across the 6 individual galleries(1-2 per image)
Problem: code for "gallery-filter" below is currently echoing out ALL(~24) media categores.
Solution needed: for only those categories acutally used on the page (rememeber 6 diff galleries)
@kevinwhoffman
kevinwhoffman / plugin.php
Last active April 15, 2022 20:46 — forked from mathetos/plugin.php
Dependent Plugin Activation/Deactivation and Alert
<?php
/*
* Dependent Plugin Activation/Deactivation
*
* Sources:
* 1. https://pippinsplugins.com/checking-dependent-plugin-active/
* 2. http://10up.com/blog/2012/wordpress-plug-in-self-deactivation/
*
*/
@kevinwhoffman
kevinwhoffman / acf-seo-image.php
Last active November 8, 2020 18:29 — forked from bahia0019/acf-seo-image.php
For ACF users, creates an easy to use function that wraps your image in HTML5 <figure> adds <figcaption>. Also adds Schema markup in JSON LD. Parameters are 1. ACF field name, 2. Size, 3. Figure CSS class, 4. Figcaption CSS class.
function fsc_figure( $image, $size, $imageclass, $captionclass ){
/**
* Let plugins pre-filter the image meta to be able to fix inconsistencies in the stored data.
*
* @param string $image The ACF field name (i.e. 'your_photo_name').
* @param string $size Thumbnail size (i.e. 'Thumbnail', 'Medium', 'Large')
* @param string $imageclass The Figure class you want to use (ex: 'my-figure')
* @param string $captionclass The Figcaption class you want to use (ex: 'caption-blue')
*/