Skip to content

Instantly share code, notes, and snippets.

View cdsaenz's full-sized avatar

charly cdsaenz

View GitHub Profile
@cdsaenz
cdsaenz / functions.php
Created December 4, 2024 18:50 — forked from unculturedswine/functions.php
Using Pardot and Formidable
<?php
add_action('frm_after_create_entry', 'sendToPardotFormHandler', 30, 2);
function sendToPardotFormHandler($entry_id, $form_id){
if($form_id == 3){ //replace 3 with the id of the form
$args = array();
if(isset($_POST['item_meta'][XX])) //change XX to the field ID
$args['firstName'] = $_POST['item_meta'][XX]; //change 'firstName' to the named parameter to send
if(isset($_POST['item_meta'][XX])) //change XX to the field ID
$args['lastName'] = $_POST['item_meta'][XX]; //change 'lastName' to whatever you need
if(isset($_POST['item_meta'][XX])) //change XX to the field ID
@cdsaenz
cdsaenz / lazy-load
Created October 30, 2024 20:54 — forked from keithdevon/lazy-load
Lazy loading WordPress images
// make sure this script is called in the footer of your document
function inView(image){
var $image = jQuery(image),
view_top = jQuery(window).scrollTop() - 300,
view_bottom = view_top + jQuery(window).height() + 600,
height = $image.height(),
_top = $image.offset().top,
_bottom = _top + height;
return height > 0 && _top <= view_bottom && _bottom >= view_top;
@cdsaenz
cdsaenz / 404.php
Created October 26, 2024 16:34
NadaPHP Minimal Framework
<!DOCTYPE html>
<html lang="en">
<head>
<?= partial('parts/head', ['title' => '404 Not Found']) ?>
</head>
<body>
<?= partial('parts/navbar') ?>
@cdsaenz
cdsaenz / website-field.php
Created September 5, 2024 18:16 — forked from cartpauj/website-field.php
Collect a website URL from users at signup in MemberPress. Allows you to store a different website URL with each user's subscription.
<?php
/*
Plugin Name: MemberPress Website Fields
Version: 1.0.0
Author: Caseproof, LLC
Author URI: http://caseproof.com
Description: Allow users to enter their website URL for each subscription they purchase
*/
//Signup form functions
@cdsaenz
cdsaenz / README.md
Created March 20, 2024 21:04 — forked from AmmarCodes/README.md
WordPress: link to specific elementor tab on a specific page

It's a quick ad-hoc solution to allow you to link to your page to a specific tab from elementor tabs widget.

Here's the catch, you need to replace the id of the specific tab you want to use to not contain the title- part.

Use https://your-website/#elementor-tab-1515

instead of: https://your-website/#elementor-tab-title-1515

@cdsaenz
cdsaenz / index.html
Created March 6, 2024 12:14 — forked from iosifnicolae2/index.html
Whatsapp Floating Button
<a href="https://wa.me/40123456789?text=hi" style="
position: fixed;
width: 60px;
height: 60px;
bottom: 32px;
right: 33px;
background-color: #25d366;
color: #FFF;
border-radius: 50px;
text-align: center;
@cdsaenz
cdsaenz / uploader.js
Created November 3, 2023 23:27
Uploader Handler
/* generic alert on error requires jquery.confirm */
function alert_error(errorMsg) {
$.confirm({
icon: 'fas fa-exclamation-triangle',
type: 'red',
title: 'Error!',
buttons: {'Close': function(){}},
content: errorMsg,
});
@cdsaenz
cdsaenz / sendsmtp.ps1
Created October 24, 2023 22:33
Send SMTP mail via 587 port and a hosting smtp server in Windows (Powershell)
$Username = "[email protected]"
$Password = "mysmtp-sender-password"
$EmailTo = "[email protected]"
$EmailFrom = "[email protected]"
$Subject = "Test Email Powershell"
$Body = "Test Email content powershell"
$SMTPServer = "mail.mysmtpserver.com"
$SMTPClient = New-Object Net.Mail.SmtpClient
$SMTPClient.Host = $SMTPServer
@cdsaenz
cdsaenz / class-jwt.php
Created September 26, 2023 00:25 — forked from davisshaver/class-jwt.php
WordPress/Coral Project Talk JWT integration
<?php
use \Firebase\JWT\JWT as JWT_Wrapper;
/**
* Class wrapper for JWT tokens.
*/
class JWT {
use Singleton;
@cdsaenz
cdsaenz / endpoint.php
Created September 16, 2023 19:01
My base AlpineJS example with fetch and bootstrap 5
<?php
/**
* Dummy Endpoint
*/
$post = JSONPost();
$quantity = isset($post['quantity']) ? intval($post['quantity']) : 10;
$strings = generateRandomStrings($quantity);
// Set the content type to JSON