Skip to content

Instantly share code, notes, and snippets.

View Garconis's full-sized avatar
🐞
Debugging

Jon Fuller Garconis

🐞
Debugging
View GitHub Profile
@Garconis
Garconis / asana-zapier-update-task-custom-fields.js
Last active March 7, 2023 22:23
Asana | Update custom fields of a task when using Zapier code
// this is wrapped in an `async` function
// you can use await throughout the function
var adCampaign = inputData.adCampaign; // get the variable from the adCampaign
var adKeyword = inputData.adKeyword; // get the variable from the adKeyword
var taskID = inputData.taskID; // get the variable from the taskID
var finalAdKeyword = "";
if ( (adKeyword == 'None') || (adKeyword == 'No Terms') || (adKeyword == '[channeldrilldown3]')) {
var finalAdKeyword = "";
}
@Garconis
Garconis / zapier-code-to-create-asana-status-update-for-project-item.js
Created March 3, 2023 22:20
Asana | Create a Status Update to the Project/Portfolio item
// this is wrapped in an `async` function
// you can use await throughout the function
// https://developers.asana.com/reference/createstatusforobject
// get parentID (the ID of the unique project)
var parentID = inputData.parentID;
let body = {
"data": {
@Garconis
Garconis / divi-dynamic-circle-number-counter-shortcode.php
Last active March 3, 2023 17:05
Divi | Shortcode to create dynamic number counter with a custom field
<?php
// https://www.youtube.com/watch?v=y1hHhUT_mfM
// example usage: [fs_dynamic_number_counter number_field="counter_1" title="Counter 1" percent="" id="" class=""]
// set the number_field value to be whatever the custom field name is that has your counter number
// set the title value to be whatever you want the counter's title to be
// set the percent value to "off" if you don't want the percent sign, otherwise leave it blank/empty for it to show
// set the id or class values if you want either of those on your module
// e.g., if you add a class, you could use it to add $ or + before or after the number value via CSS (by adding these to your stylesheet)
// e.g., .counter-dollar-before .percent-value::before { content:'$'; }
// e.g., .counter-plus-after .percent-value::after { content:'+'; }
@Garconis
Garconis / gravity-forms-full-admin-access-for-role.php
Created October 12, 2022 15:06
Gravity Forms | Give the Editor role full access to Gravity Forms in the backend
<?php
// Give the Editor role full access to Gravity Forms
function fs_add_grav_forms(){
$role = get_role('editor');
$role->add_cap('gform_full_access');
}
add_action('admin_init','fs_add_grav_forms');
@Garconis
Garconis / divi-titlebar-section-for-the-events-calendar.php
Created September 19, 2022 21:35
WordPress | Function to check for certain The Events Calendar pages and Community template
<?php
// triggers on all Divi pages before the main content
add_action( 'et_before_main_content', 'fs_banner' );
function fs_banner(){
global $post_type;
// tribe_is_community_edit_event_page() Returns true only if the Community Events submission page is currently being viewed (Edit Event, Submit Event/Add New Group)
// tribe_is_community_my_events_page() Returns true only if the Community Events “My Events” page is currently being viewed (My Groups)
// need: Edit Venue/Location, Edit an Organizer
// see list in /the-events-calendar-community-events/src/functions/template-tags.php
@Garconis
Garconis / zapier-asana-batch-add-to-multiple-projects.js
Created April 8, 2022 20:55
Asana API + Zapier | Add a task to multiple projects via Batch API
// get taskName from the custom fields above
var taskID = inputData.taskID;
// add the task to multiple projects
// notes: https://forum.asana.com/t/add-a-task-to-multiple-projects-via-api/160035/7
let body = {
"data": {
"actions": [
{
"method": "POST",
"relative_path": "/tasks/" + taskID + "/addProject",
@Garconis
Garconis / woocommerce-subscriptions-redirect-active-subscriber-with-logging-in.php
Created March 29, 2022 15:07
WooCommerce Subscriptions | Redirect subscriber with active WC subscription when logging in
<?php
function freshy_redirect_role($user_login, $user) {
//var_dump($user);
if( in_array( 'subscriber',$user->roles ) ){
//The next two lines are to check if the user has an active subscription
//in the Woocommerce Subscription plugin... if so redirect to custom path instead of WooCommerce default My Account page
if( function_exists( 'wcs_user_has_subscription' ) ) {
// Indicate whether a given user has a subscription to a given product with an optional status filter
// FYI: If the status filter is left empty, the function will see if the user has a subscription of any status
// check the user's ID, for any product ID, that has an active status ... if met returns true
@Garconis
Garconis / shortcode-team-member-schema-json.php
Created March 24, 2022 18:47
WordPress | Shortcode to output JSON-LD structured data for Person schema based on CPT + ACF fields
<?php
/* take some of the fields from the Team Member and use it to make a shortcode that outputs JSON-LD structured data for Person schema */
add_shortcode( 'fs-team-schema', 'fs_team_show_json_schema_shortcode' );
function fs_team_show_json_schema_shortcode() {
// if within an admin page and its not doing Ajax request
if ( is_admin() AND ! wp_doing_ajax() ) {
// then don't return anything since we aren't using it here
return FALSE;
@Garconis
Garconis / json-ld-person-schema.html
Created March 23, 2022 18:47
JSON-LD | Person schema structured data
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Person",
"@id": "https://freshysites.com/team/jon-fuller/#person",
"name": "Jon Fuller",
"jobTitle": "Lead Web Developer",
"Description": "Striving to solve issues and implement complex functionality — with creative user-friendly techniques and thorough constructive solutions.",
"worksFor":
{
@Garconis
Garconis / plugin-notes-plus-hide-data-based-on-user.php
Created February 25, 2022 21:48
WordPress | Hide the Plugin Notes Plus data for all users other than certain ones
<?php
// Remove the Plugin Notes Plus data for all users other than the ones we approve below
// based on their user email domain, or their user ID
// using their own filter, we hide its output
add_filter( 'plugin-notes-plus_hide_notes', 'fs_remove_plugin_notes_data_for_most_users' );
function fs_remove_plugin_notes_data_for_most_users( $hide_notes ) {
// get current user data
$current_user = wp_get_current_user();