Skip to content

Instantly share code, notes, and snippets.

Avatar

Henry Weismann weismannweb

View GitHub Profile
@weismannweb
weismannweb / Interstitial JavaScript Redirect With WP Redirection by John Godley
Last active Mar 27, 2020
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…
View Interstitial JavaScript Redirect With WP Redirection by John Godley
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 Nov 9, 2018
Auto complete learndash topics and lessons
View ld-auto-mark-complete.php
//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 Nov 2, 2018
Fix to remove 2nd bootstrap for Download Accordion FAQ Wordpress plugin when theme already has bootstrap
View add-to-functions.php
/**
* 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 Feb 28, 2021
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
View cache_category_data.xml
<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 Jun 23, 2018
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
View cache_category_data.xml
<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[