Skip to content

Instantly share code, notes, and snippets.

View mwhiteley16's full-sized avatar

Matt Whiteley mwhiteley16

View GitHub Profile
@mwhiteley16
mwhiteley16 / fsri_after_title.php
Created November 23, 2022 21:58
Filter for FSRI shortcode after title
<?php
function example_callback() {
return 'some value';
}
add_filter( 'fsri_shortcode_after_title', 'example_callback' );
@mwhiteley16
mwhiteley16 / helper.php
Created October 19, 2022 20:57
Get Category Image ID Helper
<?php
/**
* Helper function to get ID of feast category image
*
* @since 7.7.0
*
* @param string $taxonomy Name of the taxonomy
*/
function get_feast_category_image_id( $term ) {
@mwhiteley16
mwhiteley16 / config.codekit3
Created October 17, 2022 18:43
BudgetBytes CodeKit Config
{
"AAInfo" : "This is a CodeKit 3 project config file. EDITING THIS FILE IS A POOR LIFE DECISION. Doing so may cause CodeKit to crash and\/or corrupt your project. Several critical values in this file are 64-bit integers, which JavaScript JSON parsers do not support because JavaScript cannot handle 64-bit integers. These values will be corrupted if the file is parsed with JavaScript. This file is not backwards-compatible with CodeKit 1 or 2. For details, see https:\/\/codekitapp.com\/",
"buildSteps" : [
{
"name" : "Process All Remaining Files and Folders",
"stepType" : 1,
"uuidString" : "8DB4564B-D63F-45C5-A152-F67DC528DC35"
}
],
"creatorBuild" : "34434",
@mwhiteley16
mwhiteley16 / plugin-shared-counts.php
Created September 5, 2022 14:17
Shared Counts Reddit w/ Label
<?php
/**
* Shared Counts Functionality
*
* @author BillErickson
* @since 1.0.0
* @license GPL-2.0+
* @link https://sharedcountsplugin.com/2019/03/27/add-a-reddit-share-button/
**/
@mwhiteley16
mwhiteley16 / blocks.php
Created August 26, 2022 18:42
Conditionally load acf scripts
<?php
/**
* Blocks setup
*
* @link https://www.advancedcustomfields.com/resources/options-page/
*/
namespace WhiteleyDesigns\Blocks;
/**
@mwhiteley16
mwhiteley16 / blocks.php
Created August 26, 2022 13:49
Register multiple scripts with block.json
<?php
/**
* Blocks setup
*
* @link https://www.advancedcustomfields.com/resources/options-page/
*/
namespace WhiteleyDesigns\Blocks;
/**
@mwhiteley16
mwhiteley16 / block.js
Created August 26, 2022 12:38
ACF block.json script example
(function($){
// front end render on first instance of block only
$(document).ready(function(){
$('.block-faq').each(function(){
faqBlockInit();
return false;
});
});
@mwhiteley16
mwhiteley16 / block.js
Created August 25, 2022 18:50
block.json testing
(function($){
var initializeBlock = function( $block ) {
$('.block-faq__toggle-question').click(function() {
$(this).children('.block-faq__toggle-question-icons').attr('aria-selected', function (i, attr) {
return attr == 'true' ? 'false' : 'true'
});
$(this).children('.block-faq__toggle-question-icons').attr('aria-expanded', function (i, attr) {
return attr == 'true' ? 'false' : 'true'
@mwhiteley16
mwhiteley16 / potomac-dashbaod-query.php
Created July 21, 2022 19:07
Potomac Dashboard Query
<?php
wp_reset_query();
$event_ids = [];
// get events hosted by current user
$args_host = [
'author' => get_current_user_id(),
'post_type' => 'events',
'post_status' => 'publish',
'posts_per_page' => -1,
@mwhiteley16
mwhiteley16 / plugin-advanced-forms.php
Last active July 18, 2022 05:46
Index FacetWP on Form Submission/Edit
<?php
/**
* Ensure FacetWP indexes when events are created/edited forms domain
*/
add_action( 'af/form/submission', function ( $form, $fields, $args ) {
if ( isset( AF()->submission['post'] ) ) {
$post_id = AF()->submission['post'];
FWP()->indexer->index( $post_id );
// tried to reindex all, same result