Skip to content

Instantly share code, notes, and snippets.

View tomfinitely's full-sized avatar

Tom Finley tomfinitely

View GitHub Profile
@tomfinitely
tomfinitely / multisite-reusable-blocks.php
Created June 20, 2024 15:43
Synchronize Reusable Blocks Between WordPress Multisite Subsites
/**
* Sync the reusable blocks between the sites of the multisite.
*
* @param int $post_id The post id.
* @param WP_Post $post The post object.
*/
add_action( 'publish_wp_block', 'slug_sync_reusable_blocks', 10, 2 );
function slug_sync_reusable_blocks( $post_id, $post ) {
// Check if the post already has a sync_hash or create one.
if ( get_post_meta( $post_id, 'sync_hash', true ) !== '' ) {
"typography": {
"fontFamilies": [
{
"fontFamily": "\"Macklin Sans\", Frutiger, \"Frutiger Linotype\", Univers, Calibri, \"Gill Sans\", \"Gill Sans MT\", \"Myriad Pro\", Myriad, \"DejaVu Sans Condensed\", \"Liberation Sans\", \"Nimbus Sans L\", Tahoma, Geneva, \"Helvetica Neue\", Helvetica, Arial, sans-serif",
"slug": "macklin-sans",
"name": "Macklin Sans",
"fontFace": [
{
"fontFamily": "Macklin Sans",
"fontWeight": "100 200 300 400 500 600 700 800 900 950",
@tomfinitely
tomfinitely / gist:9094bb04728f3ee3dd534927b408076b
Created August 11, 2022 16:59
Twitter Mute Words For Restoring Timeline Sanity and Sanitation
suggest_recycled_tweet_inline
suggestrecycledtweet_inline
suggestpyletweet
suggestactivitytweet
suggest_timeline_tweet
suggest_sc_tweet
suggest_ranked_organic_tweet
suggest_activity_highlights
suggest_activity_feed
suggest_activity
<?php
/*
Template Name: Restuarant Menu Template
*/
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
/**
* Finds all Pardot form iframes and appends a ?embedded_on= query parameter to the source.
* Very useful for fixing the crappy issues with pardot tracking...
*/
add_filter( 'pardot_content', 'pardot_iframe_src_filter', 99, 1 );
function pardot_iframe_src_filter( $content ) {
global $post;
$permalink_path = wp_make_link_relative( get_permalink( $post->ID ) );
@tomfinitely
tomfinitely / gist:b281ecebd36e3682dac9258804c59308
Created February 13, 2018 00:20
Events Calendar Pro + Genesis Sandbox Featured Content Widgets Modifications
//* -------------------------------------------------
// ---------- GSFC + TEC Customization --------------- *//
//* Event Secondary Thumbnail Call
add_action ( 'gsfc_before_post_content', 'add_event_thumb', 1);
function add_event_thumb() {
$attr = array(
'class' => "event-thumb", // set custom class
@tomfinitely
tomfinitely / automatic-post-picker.php
Last active September 22, 2017 20:06
ACF - Automated Recent Post Picker
<section class="row widget-area post-picker auto <?php the_sub_field( 'css_class' ); the_sub_field( 'background_selector' ); ?>" id="<?php the_sub_field ('block_id'); ?>" <?php if( get_sub_field( 'background_image' ) ) { ?> style="background-image: url(<?php the_sub_field( 'background_image' ); ?>);"<?php } ?> >
<div class="wrap">
<?php if( get_sub_field( 'headline' ) ) { ?>
<h3><?php the_sub_field( 'headline' ); ?></h3>
<?php } ?>
<section class="section news-post"><div class="box wrap">
@tomfinitely
tomfinitely / reset-acf-metabox.php
Created September 7, 2017 15:48
Reset ACF Metabox Positions
function prefix_reset_metabox_positions(){
delete_user_meta( 1, 'meta-box-order_post' );
delete_user_meta( 1, 'meta-box-order_page' );
delete_user_meta( 1, 'meta-box-order_custom_post_type' );
}
add_action( 'admin_init', 'prefix_reset_metabox_positions' );
@tomfinitely
tomfinitely / gulpfile.js
Created August 3, 2017 20:12
SEOThemes Studio Pro Replacement Gulp SASS Output
/**
* Compile Sass.
*
* https://www.npmjs.com/package/gulp-sass
*/
gulp.task( 'styles', function () {
gulp.src( paths.styles )
// Notify on error
@tomfinitely
tomfinitely / template-menu.php
Created April 13, 2017 16:48
ACF-Based Restaurant Menu Template
<?php
/*
Template Name: Restuarant Menu Template2
*/
add_action( 'genesis_before_loop', 'my_restaurant_menu' );
function my_restaurant_menu () {
//My ACF Fields for reference