Skip to content

Instantly share code, notes, and snippets.

View mdailey77's full-sized avatar

Matthew Dailey mdailey77

View GitHub Profile
@mdailey77
mdailey77 / populatefieldwithmultiplecheckboxanswers.js
Created May 16, 2016 15:42
Populate one hidden form field with multiple checkbox answers using jQuery
$('.customCheckboxesRow').each(function(){
var checkboxVal = '';
var checkboxel = $(this).find('.checkbox');
// checks if checkbox was selected, if so, adds rel attribute value of each checkbox to checkboxVal variable
checkboxel.each(function(){
if ($(this).hasClass('checkActive')){
var selectedRel = $(this).attr("rel");
checkboxVal += selectedRel + ', ';
}
});
@mdailey77
mdailey77 / generic_email_template.html
Created May 16, 2016 15:59
A generic Outlook email template
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>title</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
</head>
<body>
<!-- start of container table -->
@mdailey77
mdailey77 / jstree_preferencecenter.html
Last active April 4, 2022 07:47
A customized checkbox tree structure in a preference center form
<script>
var PrefFieldsArray = ['Pref_ThoughtLeadership_HPInsight', 'Pref_Solutions_BusinessIntelligence', 'Pref_Solutions_CloudComputing', 'Pref_Solutions_Virtualization', 'Pref_Solutions_DataCenter', 'Pref_Solutions_ConvgdInfra', 'Pref_Solutions_UnifiedComms', 'Pref_Solutions_AppTransfrmtn', 'Pref_Solutions_EntPrintMoblty', 'Pref_Solutions_EntSecurity',
'Pref_Solutions_InfoMgmt', 'Pref_Solutions_Sustainblty', 'Pref_Solutions_GraphicArts', 'Pref_Solutions_Telecmmting', 'Pref_Solutions_WirelessLANNetwrkg', 'Pref_Solutions_SDN', 'Pref_Services_ITOutsourcing', 'Pref_Services_BusProcOutsrcing', 'Pref_Services_AppSvcs', 'Pref_Services_SpprtNewIT_FndtnCare', 'Pref_Services_SpprtNewIT_ProactvCare',
'Pref_Services_SpprtNewIT_DatactrCare', 'Pref_Services_ConsltSvcs_ConvgdInfra', 'Pref_Services_ConsltSvcs_Cloud', 'Pref_Services_ConsltSvcs_BigData', 'Pref_Services_ConsltSvcs_Mobility', 'Pref_Services_ConsltSvcs_Network', 'Pref_Services_ConsltSvcs_Storage', 'Pref_Services_ConsltSvcs_Server', 'Pref_Services_MngdPr
@mdailey77
mdailey77 / change_webinar_event_links.php
Last active August 4, 2017 15:28
Change Events Calendar single event permalinks when category is 'webinar'
@mdailey77
mdailey77 / getWebinars.php
Last active August 4, 2017 15:28
Display featured and upcoming webinars on the same page by calling the corresponding method. For use with the Events Calendar WordPress plugin.
class getWebinars {
function get_featured_webinars(){
// Ensure the global $post variable is in scope
global $post;
$featuredwebinars = tribe_get_events(
array(
'eventDisplay' => 'upcoming',
'posts_per_page' => 2,
'tax_query' => array(
@mdailey77
mdailey77 / deactivate_lightbox.php
Last active March 2, 2019 15:19
Run Huge IT Lightbox plugin only on certain page templates in WordPress
<?php
add_action( 'wp_print_scripts', 'deactivate_lightbox', 100 );
function deactivate_lightbox() {
if ( !is_page_template('template-products-landing.php') && !is_singular( 'product' ) ) {
wp_deregister_script( 'hugeit-lightbox-js' );
wp_deregister_script( 'hugeit-custom-js' );
wp_deregister_script( 'hugeit-froogaloop-js' );
wp_deregister_script( 'mousewheel-min-js' );
wp_deregister_script( 'hugeit-colorbox-js' );
}
@mdailey77
mdailey77 / template-webinar.php
Created June 12, 2018 17:43
Custom WordPress page template for listing webinar events in conjunction with Events Calendar API
<?php
/**
* Template Name: Custom Webinar Overview Page
*
* @package WordPress
*/
// create an instance of getWebinars class from functions.php
$getwebinars = new getWebinars();
// removes 'read more' link from excerpt
add_filter( 'the_excerpt', 'custom_remove_read_more' );
@mdailey77
mdailey77 / template-webinar-ondemand.php
Created June 12, 2018 18:35
custom WordPress page template for displaying on-demand webinar events
<?php
/**
* Template Name: All On Demand Webinars
*
* @package WordPress
*/
get_header();
?>
<div id="post-type-header">
@mdailey77
mdailey77 / cmb2fields.php
Created June 12, 2018 19:06
Register WordPress custom fields using the CMB2 PHP library
<?php
/**
* Include and setup custom metabox and fields.
*
* @category sitetheme
* @package Metaboxes
* @license http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)
* @link https://github.com/CMB2/CMB2
*/
@mdailey77
mdailey77 / sqlscriptssample.php
Created January 20, 2019 21:06
A sampling of SQL scripts I wrote for a commericial web application
<?php
// inner join of multiple tables
"SELECT od.invoiceID, od.jobID, od.invoiceDate, o.datestamp, o.purchaseOrder, od.invoiceLineNumber, od.poLineNumber, od.itemICN, od.itemQuantity, od.itemPrice, od.itemName, od.salesTax, sh.shipToID, sh.company, sh.address1, "
. "sh.city, st.stateName, c.countryName, sh.zipCode, sh.email, od.salesTax FROM ordersdetail AS od INNER JOIN orders AS o ON od.jobID = o.jobID INNER JOIN shipTo AS sh ON o.shipToID = sh.shipToID"
. " INNER JOIN states AS st ON sh.stateID=st.stateID INNER JOIN countries AS c ON sh.countryID=c.countryID WHERE od.jobID=$jobID AND od.itemICN IN ($itemICNs) AND od.deleted=0 AND o.deleted=0";
// insert statement for adding a user
"INSERT INTO users (admintype, username, password ,userEmail, firstName, lastName, active, company1, address1, address2, city, stateID, zip, countryID)" .
"VALUES ('$admintype','$username','$password' ,'$userEmail', '$firstName', '$lastName', '$active', '$company1', '$address1', '$address2', '$city', '$stateID