Skip to content

Instantly share code, notes, and snippets.

Darren Stevens celticwebdesign

Block or report user

Report or block celticwebdesign

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View WordPress Archive Date
$args = array(
'type' => 'yearly',
'limit' => '',
'format' => 'html',
'before' => '',
'after' => '',
'show_post_count' => false,
'echo' => 0,
'order' => 'DESC',
'post_type' => 'post'
View WP-Config local development environments
<?php
// ===================================================
// Load database info and local development parameters
// ===================================================
if ( file_exists( dirname( __FILE__ ) . '/local-config.php' ) ) {
define( 'WP_LOCAL_DEV', true );
include( dirname( __FILE__ ) . '/local-config.php' );
} else {
define( 'WP_LOCAL_DEV', false );
define( 'DB_NAME', '%%DB_NAME%%' );
View WordPress Archive page - Ajax Load More
<?php
// https://wordpress.stackexchange.com/a/152012
// How to show monthly archive posts?
// this can be used for many other archive pages, see the link above.
if (is_category()) {
/* If this is a category archive */
$cat = get_query_var('cat');
$category = get_category($cat);
View Merging Ajax Load More with LazyLoad
SCSS
.image-container {
position: relative;
// image is a background image of this container
// https://github.com/verlok/lazyload/blob/master/demos/fade_in.html
opacity: 0;
@include transition(400ms);
View Link test underline hover effect
View HOW TO ENABLE HTTP STRICT TRANSPORT SECURITY (HSTS) IN WORDPRESS
// HOW TO ENABLE HTTP STRICT TRANSPORT SECURITY (HSTS) IN WORDPRESS
// https://thomasgriffin.io/enable-http-strict-transport-security-hsts-wordpress/
add_action( 'send_headers', 'tgm_io_strict_transport_security' );
/**
* Enables the HTTP Strict Transport Security (HSTS) header.
*
* @since 1.0.0
*/
function tgm_io_strict_transport_security() {
@celticwebdesign
celticwebdesign / .gitignore
Created Jun 6, 2019 — forked from salcode/.gitignore
Please see https://salferrarello.com/wordpress-gitignore/ for the canonical version of this WordPress .gitignore file. Note: I do not receive notifications for comments here (because GitHub does not send notifications on Gists)
View .gitignore
# -----------------------------------------------------------------
# .gitignore for WordPress @salcode
# ver 20180808
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore
# to download this file
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.
View .gitignore
# Ignore everything #
**
!wp-content/
wp-content/**
!wp-content/themes/
!wp-content/plugins/
wp-content/themes/**
wp-content/plugins/**
# Add two rules for each Theme or Plugin you want to include:
@celticwebdesign
celticwebdesign / functions.php
Last active May 30, 2019
WordPress, Woocommerce, Cart page, add message and form (Gravity Forms) if customer country is not supported.
View functions.php
<?php
/**
Display a notice on the cart page requesting people with Countries not supported to email us.
*/
// http://hookr.io/actions/woocommerce_after_shipping_calculator/#
function action_woocommerce_after_shipping_calculator( ) {
echo '
<style>
.action_woocommerce_after_shipping_calculator {background: #eee;margin-top: 10px;padding: 10px;font-size: 1.4rem;line-height: normal;}
@celticwebdesign
celticwebdesign / scroll_snap.js
Created May 27, 2019
Any '#full_width_single_image' scroll snap.
View scroll_snap.js
// Start - any full_width_single_image scroll snap
// https://jsfiddle.net/vqakpboe/1/
if ( $("#full_width_single_image").length > 0 ) {
var timeout = 400;
var timer;
var top = true;
$(window).scroll(function(event){
clearTimeout(timer);
You can’t perform that action at this time.