Skip to content

Instantly share code, notes, and snippets.

View CesarBenavides777's full-sized avatar
🚀
To the moon

Cesar Benavides CesarBenavides777

🚀
To the moon
View GitHub Profile
@CesarBenavides777
CesarBenavides777 / FieldTypeRegistry.php
Created August 31, 2023 21:28
WPGraphqlACF - Custom ACF Table Field Extension - For Updated WPGraphQL Plugin
<?php
// ...existing code
// import
use WPGraphQL\Acf\FieldType\Table;
class FieldTypeRegistry {
// ...exising code
Table::register_field_type();
@CesarBenavides777
CesarBenavides777 / gf-integration.php
Created April 5, 2023 15:01
Gravity Forms + WPGraphQL + ACF
<?php
add_action('acf/init', 'my_acf_init');
// Removing <p> tags
remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );
// Gravity Forms ACF
if (!defined('ABSPATH')) {
exit;
}
@CesarBenavides777
CesarBenavides777 / class-config.php
Created May 16, 2022 14:39
Modified ACF Graphql Plugin to support new field
<?php
/**
* Config for WPGraphQL ACF
*
* @package wp-graphql-acf
*/
namespace WPGraphQL\ACF;
use Exception;
@CesarBenavides777
CesarBenavides777 / acf-relationship-multisite-v5.php
Created May 16, 2022 14:37
ACF Custom Multisite Relationship Field
<?php
class acf_field_relationship_multisite extends acf_field {
/*
* __construct
*
* This function will setup the field type data
*
@CesarBenavides777
CesarBenavides777 / gatsby-config.js
Created January 13, 2022 16:53
Caching on gatsby cloud in gatsby-config.js
{
resolve: `gatsby-plugin-gatsby-cloud`, // `gatsby-plugin-gatsby-cloud`
options: {
allPageHeaders: [
'Strict-Transport-Security: max-age=31536000; includeSubDomains; preload',
],
headers: {
'/*': ['Cache-Control: public, max-age=31536000, immutable'],
'static/*': ['Cache-Control: public, max-age=31536000, immutable'],
},
@CesarBenavides777
CesarBenavides777 / gatsby-browser.js
Last active February 22, 2022 15:52
Example google tag gatsby-browser
// export const onInitialClientRender = () => {
// // wait to init GTM until after React has hydrated in this lifecycle
// const dataLayer = window.dataLayer || []
// dataLayer.push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' })
// }
function initGTM() {
if (window.isGTMLoaded) {
return false
}
@CesarBenavides777
CesarBenavides777 / gatsby-ssr.js
Last active February 22, 2022 15:52
Example ssr file
import React from 'react'
export const onRenderBody = ({ setHeadComponents }) => {
setHeadComponents([
<link
rel="preconnect"
key="dns-prefetch-google-tag-manager"
href="https://www.googletagmanager.com"
as="script"
/>,

Keybase proof

I hereby claim:

  • I am cesarbenavides777 on github.
  • I am cesar777 (https://keybase.io/cesar777) on keybase.
  • I have a public key ASCxckndvSd4h1QDDpHxYRFWIpQ2oMtNd052pMaPzPLtBgo

To claim this, I am signing this object: