Skip to content

Instantly share code, notes, and snippets.

View weismannweb's full-sized avatar

Henry Weismann weismannweb

View GitHub Profile
// Math summation on columns
var myClasses= "column_one, column_two, column_three"; //give your columns key, you can use multiple by using comma
var totalText = "Total: "; // you can change the 'Total' text here
if(!$table.find('tfoot').length){
jQuery("<tfoot></tfoot>").appendTo($table);
}
@weismannweb
weismannweb / Interstitial JavaScript Redirect With WP Redirection by John Godley
Last active March 27, 2020 20:42
I am using this to load JS like Mautic, Google Analytics, Facebook Pixel before redirecting to the target URL. This has only been tested a little but. Use at your own risk. It should still log the redirect but I have not checked that yet. In order for this to work you should create a page with the slug 'interstitial'. https://wordpress.org/plugi…
add_action( 'redirection_url_target', 'wp_redirection_target');
function wp_redirection_target($url){
if(!defined('THE_REDIRECTION_TARGET')){
define('THE_REDIRECTION_TARGET',$url);
return true;
}
}
@weismannweb
weismannweb / ld-auto-mark-complete.php
Created November 9, 2018 21:35
Auto complete learndash topics and lessons
//thanks to https://gist.github.com/sultann/24baa5483b4632c3cf214a8de5648204#file-ld-auto-mark-complete-php-L17 for most of
//this code, i just corrected it to work with ld_lesson_tag to grab the tags as the original version returned empty
//array since it was looking for standard wp tags
function ld_is_tagged($postId) {
//get all learndash tags on post
$tags = wp_get_post_terms($postId,'ld_lesson_tag');
foreach ($tags as $tag) {
//need to check for auto-mark-complete tag exists on this post
@weismannweb
weismannweb / add-to-functions.php
Created November 2, 2018 07:07
Fix to remove 2nd bootstrap for Download Accordion FAQ Wordpress plugin when theme already has bootstrap
/**
* Dequeue the 2nd bootstrap script added by accordian plugin
*
* Hooked to the wp_print_scripts action, with a late priority (100),
* so that it is after the script was enqueued.
*/
function second_bootstrap_dequeue_script() {
wp_dequeue_script( 'wpsm_ac_bootstrap-js-front' );
}
add_action( 'wp_print_scripts', 'second_bootstrap_dequeue_script', 100 );
@weismannweb
weismannweb / cache_category_data.xml
Last active February 28, 2021 00:08
Caches category data for Opencart 3.0 to make it faster. Opencart installs with alot of categories are really slow. http://forum.opencart.com/viewtopic.php?f=161&t=126241
<modification>
<id>Cache category data to speed up page load for store with many categories and sub categories.</id>
<version>1.0.1</version>
<vqmver>2.3.2</vqmver>
<author>Weismann Web - www.weismannweb.com</author>
<file name="catalog/controller/extension/module/category.php">
<operation>
<search position="after"><![CDATA[
@weismannweb
weismannweb / cache_category_data.xml
Last active June 23, 2018 01:13
Caches category data for Opencart 1.5 to make it faster. Opencart installs with alot of categories are really slow. http://forum.opencart.com/viewtopic.php?f=161&t=126241 here is a new version for Opencart 3.0: https://gist.github.com/weismannweb/8add8fab5be99854db5c618d751281b2
<modification>
<id>Cache category data to speed up page load for store with many categories and sub categories.</id>
<version>1.0.1</version>
<vqmver>2.3.2</vqmver>
<author>Weismann Web - www.weismannweb.com</author>
<file name="catalog/controller/module/category.php">
<operation>
<search position="after"><![CDATA[