Skip to content

Instantly share code, notes, and snippets.

@gzalinski
gzalinski / function.php
Last active May 25, 2022 13:59
[Contact Form 7] connect script and style when gutenberg block is detected #cf7 #wp
/**
* CF7 Optimize Enqueue
*/
add_action( 'wp_enqueue_scripts', 'cf7_optimize_equeues' );
add_action( 'admin_enqueue_scripts', 'cf7_optimize_equeues' );
function cf7_optimize_equeues(){
global $post;
if( !class_exists( 'WPCF7' ) || !$post ) {
return;
@gzalinski
gzalinski / acf-rule-terms.php
Last active May 25, 2022 14:35
[ACF rule terms] ACF specific taxonomy term #wp #acf
<?php
add_filter( 'acf/location/rule_types', 'acf_location_rules_types', 999 );
function acf_location_rules_types( $choices ) {
$tax_label = __( 'News Type' ); //<--YOUR LABEL
$key = __('Forms', 'acf');
if ( ! isset( $choices[ $key ] ) ) {
$choices[ $key ] = [];
}
@gzalinski
gzalinski / HubSpot & GravityForms
Created March 16, 2020 11:46
HubSpot CURL for Gravity Form
function curl_to_hubspot($entry, $str_post, $form_ID){
$hubspotutk = $_COOKIE['hubspotutk'];
$portalID = '******'; //HubSpot USER ID
$hs_context = array(
'hutk' => $hubspotutk,
'ipAddress' => $entry['ip'],
'pageURL' => $entry['source_url'],
'pageName' => get_the_title( $entry['post_id'])