Skip to content

Instantly share code, notes, and snippets.

View lkoudal's full-sized avatar

Lars Koudal lkoudal

View GitHub Profile
@lkoudal
lkoudal / .gitignore
Created January 27, 2016 21:52 — forked from salcode/.gitignore
.gitignore file for WordPress - Bare Minimum Git
# -----------------------------------------------------------------
# .gitignore for WordPress
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20150227
#
# This file is tailored for a WordPress project
# using the default directory structure
#
# This file specifies intentionally untracked files to ignore
@lkoudal
lkoudal / wc-hide-coupons-cart-checkout.php
Created March 14, 2016 00:46 — forked from maxrice/wc-hide-coupons-cart-checkout.php
WooCommerce - hide the coupon form on the cart or checkout page, but leave coupons enabled for use with plugins like Smart Coupons and URL Coupons
<?php
// hide coupon field on cart page
function hide_coupon_field_on_cart( $enabled ) {
if ( is_cart() ) {
$enabled = false;
}
return $enabled;
@lkoudal
lkoudal / functions.php
Created June 5, 2016 19:31 — forked from yratof/functions.php
Visual Composer and Relevanssi showing shortcodes in search
<?php
// Issue with showing VC shortcodes in search results
// Strip out Visual Composer specific shortcodes
add_filter('relevanssi_pre_excerpt_content', 'rlv_trim_vc_shortcodes');
function rlv_trim_vc_shortcodes($content) {
$content = preg_replace('/\[\/?vc_.*?\]/', '', $content);
return $content;
}
@lkoudal
lkoudal / wp-config.php
Created June 12, 2016 18:09
WordPress: Prevent WordPress sending any emails
<?php
// I did this simple hack on a private WordPress Multisite blog, to stop it
// sending me emails every time I created a new blog. It's definitely overkill
// to stop all emails, but unfortunately I couldn't find any hooks that let me
// be more specific! (I didn't need any of the other emails - but you shouldn't
// use this code if you do!)
// I put the code in wp-config.php. You could create a plugin instead, or
// putting it in your theme's functions.php might work (I haven't tested it).
@lkoudal
lkoudal / test_wp_mail.php
Created July 31, 2016 06:47 — forked from strangerstudios/test_wp_mail.php
Help Debug wp_mail in WordPress
function test_wp_mail($args)
{
$debug = "<pre>" . var_export($args, true) . "</pre>";
wp_die($debug);
}
add_filter('wp_mail', 'test_wp_mail');
@lkoudal
lkoudal / CreateWordpressUser.php
Created November 24, 2016 23:45 — forked from jawinn/CreateWordpressUser.php
Create WordPress Admin User from PHP
<?php
// ADD NEW ADMIN USER TO WORDPRESS
// ----------------------------------
// Put this file in your Wordpress root directory and run it from your browser.
// Delete it when you're done.
require_once('wp-blog-header.php');
require_once('wp-includes/registration.php');
// ----------------------------------------------------
@lkoudal
lkoudal / private-debug-log.php
Created November 27, 2016 18:02 — forked from webaware/private-debug-log.php
Enable WordPress debug log to a private folder not accessible from the web. See http://wordpress.stackexchange.com/q/84132/24260 for details and motivations. NB: currently needs to be manually edited to specify the private folder path;
<?php
/*
Plugin Name: Private Debug Log
Description: Enable debug log to a private folder not accessible from the web
Version: 0.0.1
Author: WebAware
Author URI: http://www.webaware.com.au/
*/
/*
@lkoudal
lkoudal / .htaccess
Created January 20, 2017 01:29 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@lkoudal
lkoudal / vc-custom-element.php
Created January 21, 2017 02:26
WP: Visual composer custom element
<?php
// Before VC Init
add_action( 'vc_before_init', 'vc_before_init_actions' );
function vc_before_init_actions() {
//.. Code from other Tutorials ..//
// Require new custom Element
@lkoudal
lkoudal / config
Created May 27, 2017 19:59 — forked from peterpme/config
SSH Config Taken From Paul Irish. Thanks Paul!
# symlink to ~/.ssh/config
Host github.com
ControlMaster auto
ControlPersist 120
Host *
# Always use SSH2.
Protocol 2