Skip to content

Instantly share code, notes, and snippets.

View KustomDeveloper's full-sized avatar
:octocat:
Building React Apps

Michael Hicks KustomDeveloper

:octocat:
Building React Apps
View GitHub Profile
@KustomDeveloper
KustomDeveloper / cf7-form
Last active February 6, 2023 16:03
CF7- Wordpress-Redirect to Google Reviews Page If Customer Leaves 5 Star Review
<h3>Leave a Review</h3>
<label> Name
[text* your-name autocomplete:name] </label>
<b>Rating</b> [radio review-radio default:1 "5" "4" "3" "2" "1"]
<label> Your Review
[textarea* your-review x4]</label>
[dscf7captcha dscf7captcha-205]
@KustomDeveloper
KustomDeveloper / .cmd
Last active February 6, 2023 15:53
Windows Powershell | Change multiple filenames in Folder
Open a Command Prompt.
Go to the folder with the cd command (eg.: cd "path of your folder").
Open a powershell by typing: powershell
Then input this: get-childitem *.mp3 | foreach {rename-item $_ $_.name.replace(" ","")}
@KustomDeveloper
KustomDeveloper / main.js
Created July 29, 2022 19:20
Load Video On Click
<script>
jQuery(function() {
jQuery('.video-container').on('click', function(e) {
e.preventDefault();
var iframe = j(this).find('iframe');
var url = iframe.attr('data-src');
var srcValue = iframe.attr('src');
if(srcValue == 'about:blank') {
@KustomDeveloper
KustomDeveloper / functions.php
Created December 30, 2021 21:17
Register custom meta box on custom post type to show in wp rest api
/*
* Register custom meta box on custom post type to show in wp rest api
*
* Custom post type must support 'custom-fields' and have the 'show_in_rest' parameter set to true
*/
//Custom post type is 'audio' and custom meta box is 'cloud_url'
add_action( 'rest_api_init', function () {
register_rest_field( 'audio', 'cloud_url', array(
<?php
/*Add CTA Wp Bakery Component*/
class VcHubspotCta extends WPBakeryShortCode {
function __construct() {
add_action( 'init', array( $this, 'create_shortcode' ), 999 );
add_shortcode( 'vc_hubspot_cta', array( $this, 'render_shortcode' ) );
}
@KustomDeveloper
KustomDeveloper / functions.php
Created March 24, 2021 15:21
CF7 Error Notifications
/*
* Send Notification if a CF7 Form fails
*/
function cf7_error_notifications() { ?>
<script type="text/javascript">
document.addEventListener( 'wpcf7mailfailed', function( event ) {
<?php
wp_mail( 'youremail@gmail.com', 'Form Failed', 'CF7 Form failed to send', array('Content-Type: text/html; charset=UTF-8'));
?>
@KustomDeveloper
KustomDeveloper / functions.php
Created February 11, 2021 20:39
Get data from contact form 7 submission for use in another function like for example: mailchimp, constant contact, etc.
function run_function_with_cf7_data($WPCF7_ContactForm) {
$submission = WPCF7_Submission::get_instance();
if ( $submission ) {
// $posted_data = $submission->get_posted_data();
$email = $submission->get_posted_data('your-email');
ob_start();
@KustomDeveloper
KustomDeveloper / commands.md
Last active February 1, 2021 14:13
Browser Syncing using browser-sync on wamp

Browser Sync Setup

Notes

'localhost/bugsy' is the local directory of the website inside the wamp folder

Commands

npm i browser-sync

$ browser-sync start --proxy 'localhost/bugsy' --files '**/*' --no-notify

//Add to functions.php
<?php
function add_number_of_cart_items() {
global $woocommerce;
$cart_count = $woocommerce->cart->cart_contents_count;
?>
<script>
var cartCount = <?php echo $cart_count; ?>;
var node = document.createElement("span");
@KustomDeveloper
KustomDeveloper / index.html
Last active July 14, 2022 06:39
Simple website with GSAP animations
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>AlphaStar</title>
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,400i,600,700,900" rel="stylesheet">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/style.css"> </head>