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 / functions.php
Created July 12, 2019 18:27
Require a Featured Image Before You Can Publish a Post in Wordpress
/*
* Require a Featured Image Before You Can Publish a Post
*/
function wpds_check_thumbnail($post_id) {
// change to any custom post type
if(get_post_type($post_id) != 'post')
return;
if ( !has_post_thumbnail( $post_id ) ) {
@KustomDeveloper
KustomDeveloper / ProcessWire form-example.php
Last active July 25, 2019 20:23 — forked from somatonic/form-example.php
PW simple form via API
<?php
$out = '';
// create a new form field (also field wrapper)
$form = $modules->get("InputfieldForm");
$form->action = "./";
$form->method = "post";
$form->attr("id+name",'subscribe-form');
@KustomDeveloper
KustomDeveloper / header.php
Created August 16, 2019 15:22
ProcessWire Superuser password change
//Add to header.php file and reload page
<?php
$u = $users->get('admin'); // or whatever your supersuser name is
$u->of(false);
$u->pass = 'strong_password';
$u->save();
?>
@KustomDeveloper
KustomDeveloper / .htaccess
Created October 3, 2019 17:36
Allow unbounce to access fonts on my webserver
# Apache config
<FilesMatch ".(eot|ttf|otf|woff|woff2)">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
@KustomDeveloper
KustomDeveloper / scripts.js
Created October 3, 2019 17:38
Form scroll functions and fixed form for landing pages
//Scroll to form on button click and focus on first input
$('#up-to-form').on('click', function(e) {
e.preventDefault();
$('html, body').animate({
scrollTop: $('.form-container').offset().top - 20
}, 'slow');
$('.form-container form input').first().focus();
});
//Make form fixed so it stays in view on desktop viewport
@KustomDeveloper
KustomDeveloper / google-reviews.php
Created October 16, 2019 13:43 — forked from iambrianreich/google-reviews.php
Use the Google Places API to render a Google My Business reviews badge on a WordPress site using shortcodes.
<?php /** @noinspection SpellCheckingInspection */
/**
* This file contains the WordPress code for rendering a Google Reviews badge.
*
* Usage:
*
* 1. Create a Google API Console account if you have not already done so.
* 2. Register for the Google Places API.
* 3. Create an API key.
* 4. Ensure that the API key can be used from wherever this script will execute
@KustomDeveloper
KustomDeveloper / loop.js
Created February 5, 2020 22:57
Make a copy of a set of elements and loop through them using es6
[...document.querySelectorAll('.navlink')].forEach((item) => {
setTimeout(() => {
TweenMax.to(item, 0.1, {left:0});
}, 300)
});
@KustomDeveloper
KustomDeveloper / cart.html
Created May 15, 2020 22:22
Kartra Custom Checkout
<div class="row row--equal" data-component="grid" data-builder="edit del clone dnd col">
<div class="col-md-5" data-builder="edit del dnd">
<div class="js_kartra_component_holder">
<div class="kartra_element_bg kartra_element_bg--padding-special-medium kartra_element_bg--margin-bottom-special-medium js_kartra_component_holder" data-component="bundle" data-builder="dnd clone edit del edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit edit" data-selector="div[data-component=bundle]" style="margin-top: 0px; margin-bottom: 30px; padding: 30px;">
<div class="background-item background_changer--blur0" style="background-color: rgb(242, 242, 242); border-radius: 0px; border-color: rgb(240, 185, 17); border-style: dashed; border-width: 2px; background-image: none; opacity: 1;"
@KustomDeveloper
KustomDeveloper / leadshook_webhook.json
Last active June 25, 2020 15:56
Lead Hook to Google Sheets
{"first_name":"John","last_name":"Doe","email":"[email protected]","phone_number":"5552341245","i_currently_live_in_the_following_state":"California","date_of_birth":"5/21/1993","webhook_answer_height":"6 foot","my_weight_slider":"100","are_you_raising_at_least_1_child_in_your_home":"Yes","do_you_receive_financial_assistance_2":"No","do_you_receive_financial_aid":"Yes","please_list_any_criminal_history_including_dui_minor_etc":"None","tobacco_use":"No","pregnancy_complication":"No","please_select_any_sexually_transmitted_infections_you_have_had_if_any":"None","please_check_if_you_experience_any_of_the_following":"Check experience","have_you_taken_any_medications_in_the_last_12_months":"No","please_list_any_supplements_or_medications_you_are_currently_taking":"No Medicines","pregnancy_1":"Pregnancy 1 result","pregnancy_2":"Pregnancy 2 result","pregnancy_3":"Pregnancy 3 result","pregnancy_4":"Pregnancy 4 result","pregnancy_5":"Pregnancy 5 result","pregnancy_6":"Pregnancy 6 result","pregnancy_7":"Pregnancy 7 result",
@KustomDeveloper
KustomDeveloper / functions.php
Last active August 4, 2020 21:28
Shortcode for image cta's
/*
* Shortcode for image cta
*/
function cta_one( $atts ) {
$a = shortcode_atts( array(
'max_width' => '800px'
), $atts );
$img_src = get_template_directory_uri() . "/images/free-food-calc-wide.gif";