Skip to content

Instantly share code, notes, and snippets.

View lkoudal's full-sized avatar

Lars Koudal lkoudal

View GitHub Profile
@lkoudal
lkoudal / emails.php
Created March 7, 2018 23:07 — forked from tameemsafi/emails.php
Send an email programmatically in wordpress with wp_mail using the woocommerce transaction emails template.
<?php
// Define a constant to use with html emails
define("HTML_EMAIL_HEADERS", array('Content-Type: text/html; charset=UTF-8'));
// @email - Email address of the reciever
// @subject - Subject of the email
// @heading - Heading to place inside of the woocommerce template
// @message - Body content (can be HTML)
function send_email_woocommerce_style($email, $subject, $heading, $message) {
@lkoudal
lkoudal / class-woothemes-sensei-list-table.php
Created May 2, 2018 16:22 — forked from dwainm/class-woothemes-sensei-list-table.php
Updated Sensei WP_List_Table class implementation
<?php
/**
* Base class for displaying a list of items in an ajaxified HTML table.
*
* @since 3.1.0
* @access private
*
* @package WordPress
* @subpackage List_Table
*/
@lkoudal
lkoudal / functions.php
Created October 27, 2020 22:24 — forked from thetwopct/functions.php
Preload any footer JS files in the header
/**
* Preload any footer JS files in the header
*
* originally from: https://macarthur.me/posts/preloading-javascript-in-wordpress
*/
add_action('wp_head', function () {
global $wp_scripts;
@lkoudal
lkoudal / lazy-elementor-background-images.php
Created November 20, 2020 16:44 — forked from jrevillini/lazy-elementor-background-images.php
lazyload elementor background images
<?php
// NEWS!!! NEWS!!! **** FEBRUARY 2020 //
// I rolled this code into a plugin!
// Download plugin Lazy Load Background Images for Elementor. Link is in comments below.
// Or go to https://james.revillini.com/projects/
// if you don't want another plugin, the code below works (last time I checked)
# Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install composer
brew install homebrew/php/composer
### PHPCS
composer global require "squizlabs/php_codesniffer=*"
# Add to your .bash_profile
@lkoudal
lkoudal / wp_gtm_data_layer_gravity_forms.php
Created February 22, 2021 13:42 — forked from tammalee/wp_gtm_data_layer_gravity_forms.php
[WP] GTM data layer push for Gravity Forms
<?
/**
* GTM data layer push for gravity forms contact form
*/
/**
* Pushes a submission variables to the GTM dataLayer
* Also pushes the event label for use in GTM tracking
* @param Array $entry the data submitted with the form
* @param Array $form Form data
* @return null
@lkoudal
lkoudal / wpa-clean-header.php
Created July 21, 2021 16:20 — forked from Auke1810/wpa-clean-header.php
create a clean wordpress header and remove unnecessary clutter.
<?php
/*
Plugin Name: wordpress assist clean header
Plugin URI: http://www.wordpressassist.nl/
Description: Remove shortlink hook
Version: 1.0
Author: AukeJomm
Author URI: http://www.aukejongbloed.nl
*/
@lkoudal
lkoudal / AnimationName-1628990281467-118.css
Last active August 15, 2021 01:18 — forked from GradientAnimator/AnimationName-1628990281467-118.css
CSS Gradient Animation krystal-healerhuset BG anim
.css-selector {
    background: linear-gradient(288deg, #8b7acb, #f69786, #f2c4bc, #c4bfd5);
    background-size: 800% 800%;
    -webkit-animation: AnimationName 46s ease infinite;
    -moz-animation: AnimationName 46s ease infinite;
    -o-animation: AnimationName 46s ease infinite;
    animation: AnimationName 46s ease infinite;
}
@-webkit-keyframes AnimationName {
    0%{background-position:30% 0%}
@lkoudal
lkoudal / search_templates
Created October 7, 2021 20:31 — forked from bobpoekert/search_templates
A machine readable list of search engines. Each line is a query template, where all occurrences of {searchTerms} should be replaced with the search query. These were scraped off mycroft.mozdev.org, and tested that they at least respond with a page that contains the input query (to remove pages that lie behind login walls).
http://0-www.sciencedirect.com.www.consuls.org/science?_ob=QuickSearchURL&_method=submitForm&_acct=C000050221&md5=0c4b6db32507e4a332b2aa6dd47a65f4&qs_all={searchTerms}&qs_author=&qs_title=&qs_vol=&qs_issue=&qs_pages=&x=34&y=15
http://0-dictionary.oed.com.library.utulsa.edu/cgi/findword?query_type=word&queryword={searchTerms}
http://100.daum.net/search/search.do?query={searchTerms}
http://1000corks.com/search?st={searchTerms}&src=myc
http://11870.com/konsulto/{searchTerms}
http://1000memories.com/search?q={searchTerms}
http://130.219.35.129/search?q={searchTerms}&btnG=Google+Search&entqr=0&output=xml_no_dtd&sort=date%3AD%3AL%3Ad1&client=default_frontend&ud=1&oe=UTF-8&ie=UTF-8&proxystylesheet=default_frontend&site=default_collection
http://1337x.org/search/{searchTerms}/0/
http://11888.ote.gr/web/guest/white-pages/search?who={searchTerms}&where=
http://140.111.34.46/cgi-bin/newDict/dict.sh?idx=dict.idx&cond={searchTerms}&pieceLen=50&fld=1&cat=&imgFont=1
@lkoudal
lkoudal / wp-admin-modal-dialog.php
Created December 13, 2021 20:31 — forked from anttiviljami/wp-admin-modal-dialog.php
WordPress admin modal dialog example
<?php
// enqueue these scripts and styles before admin_head
wp_enqueue_script( 'jquery-ui-dialog' ); // jquery and jquery-ui should be dependencies, didn't check though...
wp_enqueue_style( 'wp-jquery-ui-dialog' );
?>
<!-- The modal / dialog box, hidden somewhere near the footer -->
<div id="my-dialog" class="hidden" style="max-width:800px">
<h3>Dialog content</h3>
<p>This is some terribly exciting content inside this dialog. Don't you agree?</p>