Skip to content

Instantly share code, notes, and snippets.

View danielmcclure's full-sized avatar

Daniel McClure danielmcclure

View GitHub Profile
@danielmcclure
danielmcclure / functions.php
Created December 20, 2018 23:07
Enqueue Font Awesome 5 in WordPress
<?php
// Enqueue Font Awesome 5 in WordPress
function tme_load_font_awesome() {
// You can find the current URL for the latest version here: https://fontawesome.com/start
wp_enqueue_style( 'font-awesome-free', '//use.fontawesome.com/releases/v5.6.3/css/all.css' );
}
add_action( 'wp_enqueue_scripts', 'tme_load_font_awesome' );
@danielmcclure
danielmcclure / functions.php
Created February 29, 2024 22:53
Add Prefix to Search & Filter Option Labels
<?php
// Add prefix to Search & Filter Option Labels
function filter_input_object($input_object, $sfid) {
//* Exclude all non-targeted fields
if(($input_object['name']!='_sft_field_name')) {
return $input_object;
}
//* Exclude fields without options
if(!isset($input_object['options'])) {
@danielmcclure
danielmcclure / sf-pro-filter-input-object.php
Created February 6, 2024 23:01 — forked from rmorse/sf-pro-filter-input-object.php
Search & Filter Pro - Filter Input Object
<?php
function filter_input_object($input_object, $sfid)
{
//ensure we are only filtering the correct field name - in this case the field we want to filter has the name `_sfm_colours`
//we also want to make sure its a `select` input type we're filtering
if(($input_object['name']!='_sfm_colours')||($input_object['type']!='select'))
{
return $input_object;
}
@danielmcclure
danielmcclure / facebook-wca-standard-events.html
Last active January 14, 2024 14:54
Sample Facebook Standard Events for New Facebook WCA (Website Custom Audience) Pixel
<!-- Facebook Custom Audience Pixel Code - Placed on Every Page of Site -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
fbq('init', '{{facebook pixel}}');
fbq('track', 'PageView');
</script>
@danielmcclure
danielmcclure / functions.php
Created October 23, 2023 21:50
Enable Custom ACF Blocks in Newsletter Glue
<?php
// Update Allowed Blocks in Newsletter Glue
function add_custom_allowed_blocks( $blocks ) {
// Add your custom block to the array
$blocks[] = 'acf/my-block'; // Change to your block's actual name. Use hyphens instead of underscores.
return $blocks; // Return modified array
}
add_filter( 'newsletterglue_allowed_block_list', 'add_custom_allowed_blocks', 10 );
@danielmcclure
danielmcclure / functions.php
Created August 22, 2023 07:27
Change Default WordPress Sender Email
<?php
// Edit the address and name below
add_filter( 'wp_mail_from', function ( $original_email_address ) {
return 'your.email@example.com';
} );
// Change the From name.
add_filter( 'wp_mail_from_name', function ( $original_email_from ) {
return 'Your Name';
@danielmcclure
danielmcclure / functions.php
Last active July 10, 2023 00:31
Add Google Tag Manager to Genesis Theme
<?php
// Add Google Tag Manager code in <head>
add_action( 'wp_head', 'm3_google_tag_manager_head' );
function m3_google_tag_manager_head() { ?>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
@danielmcclure
danielmcclure / functions.php
Created June 21, 2023 22:47
Disable WP Auto Update Notifications
<?p
// Disable WordPress Core Update Notifications
add_filter( 'auto_core_update_send_email', 'tme_stop_auto_update_emails', 10, 4 );
function tme_stop_update_emails( $send, $type, $core_update, $result ) {
if ( ! empty( $type ) && $type == 'success' ) {
return false;
}
return true;
}
@danielmcclure
danielmcclure / WordPress-ping-list.txt
Created March 30, 2017 20:17
Updated & De-Duplicated WordPress Ping List Based on Codex
http://rpc.pingomatic.com
https://rpc.pingomatic.com/
http://api.feedster.com/ping
http://api.moreover.com/ping
http://api.moreover.com/RPC2
http://bblog.com/ping.php
http://blo.gs/ping.php
http://blog.goo.ne.jp/XMLRPC
http://blogs.yandex.ru/
http://blogsearch.google.ae/ping/RPC2
@danielmcclure
danielmcclure / functions.php
Last active February 27, 2023 11:13
Login Status body Class - Add Logged In/Out class to <body> with WordPress
<?php
/**
* Plugin Name: Login Status Body Class
* Plugin URI: https://gist.github.com/danielmcclure/31463eb8c72316b21154f45483ad6777
* Description: Adds logged-in or logged-out class to body tag depending on login status.
* Version: 1.0.0
* Author: danielmcclure
* Author URI: https://danielmcclure.com/
* License: GPL-2.0+