This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Trying to create a function to use wp_remote_post() instead of cURL. | |
// Based off this example, http://developers.hubspot.com/docs/methods/forms/submit_form | |
public function send_hubspot_data( $first_name, $last_name, $email ) { | |
$hubspotutk = $_COOKIE['hubspotutk']; // grab the cookie from the visitors browser. | |
$ipaddress = $_SERVER['REMOTE_ADDR']; // IP address. | |
$hs_context = array( | |
'hutk' => $hubspotutk, | |
'ipAddress' => $ipaddress, | |
'pageUrl' => $_SERVER['request_uri'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
# The name of the script you are intending to run. | |
name: Deployment | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch. | |
# I left my branch name as main, but you could change this to whatever your branches are called. | |
push: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Theme Showdown 2020 Helper Plugin | |
* Plugin URI: https://www.ithemes.com/training | |
* Description: Plugin that includes handy helpful code snippets for Theme Showdown 2020 | |
* Author: iThemes / AJ Morris | |
* Author URI: https://www.ithemes.com/training | |
* Text Domain: ithemes-training | |
* Domain Path: /languages | |
* Version: 1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Adding this to get the form and entry object from Gravity Forms so I can test the connector. | |
add_action('gform_after_submission', 'print_form_and_entry_object', 10, 2); | |
function print_form_and_entry_object($entry, $form) { | |
ob_start(); | |
var_dump($entry); | |
var_dump($form); | |
$contents = ob_get_contents(); | |
ob_end_clean(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Check if a specific product category is in the cart | |
*/ | |
function wc_ninja_category_is_in_the_cart() { | |
// Add your special category slugs here | |
$categories = array( 'clothing', 'posters' ); | |
// Products currently in the cart | |
$cart_ids = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Conditionally remove a checkout field based on products in the cart | |
*/ | |
function wc_ninja_remove_checkout_field( $fields ) { | |
if ( ! wc_ninja_product_is_in_the_cart() ) { | |
unset( $fields['billing']['billing_company'] ); | |
} | |
return $fields; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Check if a specific product ID is in the cart | |
*/ | |
function wc_ninja_product_is_in_the_cart() { | |
// Add your special product IDs here | |
$ids = array( '45', '70', '75' );; | |
// Products currently in the cart | |
$cart_ids = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function hwid_load_custom_tab( $tab_key, $tab_info ) { | |
echo apply_filters( 'the_content', $tab_info['tabContent'] ); | |
} | |
function hwid_add_content_tabs( $tabs ) { | |
global $post; | |
$custom_tabs = get_field( 'tabs', $post->ID ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if( function_exists('acf_add_local_field_group') ): | |
acf_add_local_field_group(array ( | |
'key' => 'acf_product_options', | |
'title' => 'Product Options', | |
'fields' => array ( | |
array ( | |
'key' => 'acf_product_options_tabbedcontent_label', | |
'label' => 'Tabbed Content', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mytheme_admin_bar_render() { | |
global $wp_admin_bar; | |
$wp_admin_bar->remove_menu('headway'); | |
} | |
add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' ); |
NewerOlder