Skip to content

Instantly share code, notes, and snippets.

View mwhiteley16's full-sized avatar

Matt Whiteley mwhiteley16

View GitHub Profile
@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
<link rel="stylesheet" href="https://use.typekit.net/yzb4jok.css">
<script src="https://kit.fontawesome.com/7bb1dd36e7.js" crossorigin="anonymous"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-154958544-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
@mwhiteley16
mwhiteley16 / config.codekit3
Created May 12, 2022 19:37
PelotonU 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" : "C2788240-9A99-4E16-A805-9752408D7E75"
}
],
"creatorBuild" : "34335",
@mwhiteley16
mwhiteley16 / Additional CSS by iMark Team
Created May 6, 2022 12:31
BudgetBytes legacy code snippets
<?php
add_action('wp_head', function(){ ?>
<style>
@media (max-width: 536px){
.home-about-section.app img {
max-width: 100%;
}
.home-about-section.about {
position: initial;
}
<?php
/**
* Table of Contents
*
* @package Fed & Fit
* @author Matt Whiteley
* @since 1.0.0
* @license GPL-2.0+
**/
@mwhiteley16
mwhiteley16 / single-teamp.php
Last active February 15, 2022 02:10
single-team.php
<?php
/**
* Custom loop for related posts
*/
add_action( 'genesis_after_entry_content', 'wd_single_team_loop' );
function wd_single_team_loop() {
wp_reset_query();
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = [