Skip to content

Instantly share code, notes, and snippets.

@atwellpub
atwellpub / Google App Script - Replace Slide Content Using Google Sheet Data.js
Last active May 2, 2024 05:21
Google Apps Script function to replace text in Google Slides with Google Sheet values
/**
* Function to replace text in Google Slides with Google Sheet values
* @reference https://hudsonatwell.co/2020/10/03/how-to-use-google-slides-to-autogenerate-featured-images/
*/
function generate_featured_image() {
/* get spreadsheet from public view link */
var dataSpreadsheetUrl = "https://docs.google.com/spreadsheets/d/1necmbNPUsGJ3fwNiFpgNLbtH6c2RmJDwIQCPuhAfA7s/edit"; //make sure this includes the '/edit at the end
var ss = SpreadsheetApp.openByUrl(dataSpreadsheetUrl);
<?php
/**
* @credits https://jeroensormani.com/adding-a-custom-woocommerce-product-type/
*/
//error_reporting(E_ALL);
//ini_set('display_errors', 1);
add_action('init' , 'wc_pm_load_product_type');
function wc_pm_load_product_type() {
@atwellpub
atwellpub / functions.php
Last active May 6, 2023 21:10
Juptiter WordPress theme. Custom redirect after login.
<?php
/**
* Redirect admins to the dashboard and other users to //kmizs.com/user/
*/
add_filter( 'login_redirect', 'codeable_custom_login_redirect', 11, 3 );
function codeable_custom_login_redirect( $redirect_to, $request, $user ) {
if ( is_array( $user->roles ) ) {
if ( in_array( 'administrator', $user->roles ) ) {
<?php
/**
*
*/
public static function get_rule_logs( $query ) {
if (!isset($query['rule_id']) || !$query['rule_id']) {
return [];
}
@atwellpub
atwellpub / logs.php
Created April 14, 2022 21:41
Draft method of retrieving logs from database
<?php
/*
*
*/
public function get_special_logs( $query ) {
if (!isset($query['special_id']) || !$query['special_id']) {
return [];
}
@atwellpub
atwellpub / store-lead.php
Created September 13, 2016 23:27
For Ninja Forms Devs
<?php if (!defined('ABSPATH')) exit;
/**
* Class NF_Action_Save
*/
if (class_exists('NF_Abstracts_Action')) {
final class NF_Actions_Inbound_Store_Lead extends NF_Abstracts_Action {
/**
* @var string
@atwellpub
atwellpub / functions.php
Created October 4, 2021 16:52
Very simple child theme functions.php
<?php
class ChildTheme {
/**
*
*/
public function __construct() {
$this->load_hooks();
}
@atwellpub
atwellpub / class.register-taxonomy.php
Last active June 24, 2021 15:40
taxonomy registration for CPT
<?php
namespace Example\Register\Taxonomy;
class Profile_Tag {
static $taxonomy_name;
/**
* Initialize Profile_Tag class
<?php
$UK = array(
'England' => array(
'Abingdon',
'Accrington',
'Acton',
'Adlington',
'Alcester',
@atwellpub
atwellpub / wrapper.php
Last active September 1, 2020 20:04
Inbound API PHP wrapper examples. /leads/
<?php
/* This example seeks to help developers understand how to access the /leads/ endpoint.
*
*/
if ( !class_exists( 'Example_API_Calls' )) {
class Example_API_Calls {