Skip to content

Instantly share code, notes, and snippets.


Jon Fuller Garconis

View GitHub Profile
Garconis / divi-child-theme-enqueue-functions.php
Created Dec 1, 2021
WordPress | Divi child theme enqueue for use in functions.php
View divi-child-theme-enqueue-functions.php
<?php // goes in functions.php
/* Enqueue necessary CSS and JS files for Child Theme */
function fs_theme_enqueue_stuff() {
// Divi assigns its style.css with this handle
$parent_handle = 'divi-style';
// Get the current child theme data
$current_theme = wp_get_theme();
// get the parent version number of the current child theme
$parent_version = $current_theme->parent()->get('Version');
// get the version number of the current child theme
Garconis / remove-wordpress-column-from-admin-plugin-list.php
Created Nov 29, 2021
WordPress | Hide (remove) a column in the in the admin plugin list
View remove-wordpress-column-from-admin-plugin-list.php
// Remove the Plugin Notes Plus column for all users other than the ones we approve below
// based on their user email domain, or their user ID
// manipulate the Plugins admin page columns
function fs_remove_plugin_notes_columns_for_most_users($column_headers) {
// get current user data
$current_user = wp_get_current_user();
Garconis / zapier-code-check-field-value-exists.js
Created Oct 29, 2021
Zapier | Check if field exists or has value, then change the output value if it does or doesn't
View zapier-code-check-field-value-exists.js
// this is wrapped in an `async` function
// you can use await throughout the function
// just in case, initially we set the output of this object to be false
output = {clientIdResult: false};
// get the variable from the inputData we added to this Action
var clientid = inputData.clientId;
// check if the variable had data
Garconis / gravity-forms-google-analytics-client-id-field.js
Last active Dec 29, 2021
Google Analytics | Get GA Client ID cookie data and other GA data on Gravity Form submit via hidden fields
View gravity-forms-google-analytics-client-id-field.js
// get GA Client ID when using analytics.js
// set the tracker data via the ready callback
// more info:
// fields we can get with a tracker:
// helpers:
// helpers:
// check to see if the ID exists first
var gform_6_exists = document.getElementById('gform_6');
Garconis / create-new-asana-task-via-api-within-zapier.js
Last active May 17, 2021
Asana | Create new Asana task via API within Zapier
View create-new-asana-task-via-api-within-zapier.js
// this is wrapped in an `async` function
// you can use await throughout the function
// get personName
var personName = inputData.personName;
// get dateStart
var dateStart = inputData.dateStart;
// get dateEnd
var dateEnd = inputData.dateEnd;
// get dateDuration
Garconis / taxonomy-term-rewrite-to-remove-taxonomy-slug.php
Created May 12, 2021
WordPress | Rewrite taxonomy term link URL to remove taxonomy slug
View taxonomy-term-rewrite-to-remove-taxonomy-slug.php
// Requires going to Settings > Permalink Settings, and resaving any time you make a change to this Snippet.
// Within the CPT UI settings for the Taxonomy, be sure Rewrite is set to True, but that there is no Custom Rewrite Slug used.
// These functions help forcibly remove the taxonomy's slug from the term's URL.
// You will need to keep an eye out for slug clashes (particularly with Pages or Posts), since this doesn't prevent those.
* Help WordPress to force rewrites so it can know what the URL is that we want for each term
Garconis / check-if-child-pages-of-parent-has-certain-slug.php
Created Apr 22, 2021
WordPress | Check if parent page has child page of certain slug
View check-if-child-pages-of-parent-has-certain-slug.php
function fs_sc_location_seo_iconbox( $atts ){
// begin output buffering
global $post; // if outside the loop
$slug_to_check = 'seo';
Garconis / wp-all-import-update-posts-by-matching-slug.php
Created Apr 21, 2021
WP All Import | Update list of posts by matching post slug via Record Matching
View wp-all-import-update-posts-by-matching-slug.php
// Create custom PHP function that we can use in the "Post ID" field under Record Matching
// We pass the post slug to our function, then we use this function tot look up the post by its slug, to return the Post ID
function fs_get_post_by_slug( $slug, $post_type = 'post' ) {
if ( $post = get_page_by_path( $slug, OBJECT, $post_type ) ) {
return $post->ID;
Garconis / set-published-post-date-to-now-for-post-id.php
Created Feb 26, 2021
WordPress | Always set Published Post Date to today (NOW) for certain Post ID
View set-published-post-date-to-now-for-post-id.php
// get current time
$time = current_time('mysql');
// set the post ID to have a post date of NOW
array (
'ID' => 3274, // ID of the post to update
'post_date' => $time,
'post_date_gmt' => get_gmt_from_date( $time )
Garconis / hide-aioseo-details-admin-column-for-some-users.php
Last active Feb 8, 2021
WordPress | Hide the AIOSEO Details column for users without a certain email address
View hide-aioseo-details-admin-column-for-some-users.php
// enable if AIOSEO is active
if ( function_exists( 'aioseo' ) ) {
// fires after WordPress has finished loading but before any headers are sent.
add_action( 'init', function() {
// get current User
$user = wp_get_current_user();
// get their email address
$email = $user->user_email;
// check the email's domain