Skip to content

Instantly share code, notes, and snippets.

@jayj
jayj / gist:1190106
Created September 2, 2011 22:30
Full code for tutorial on Jayj.dk
<?php
/**
* Custom "Download" custom type for tutorial on Jayj.dk
*
* @link http://jayj.dk/2011/download-cpt-wordpress
*/
add_action( 'init', 'jayj_create_download_post_type' );
@benhuson
benhuson / sitepress.class.patch.php
Created July 6, 2012 11:16
WPML Serialised Custom Fields Patch
diff --git a/sitepress.class.php b/sitepress.class.php
index d5b2802be9a9de8b64244e889328b3e2ad776c9b..ecd861877107f00a7b111c3477bd65df12e86e6f 100644
--- a/sitepress.class.php
+++ b/sitepress.class.php
@@ -2775,7 +2775,7 @@ class SitePress{
// if the list of values has 1 element run update
// this will either ADD or UPDATE the value on the translated document
if(count($meta_values) == 1){
@spivurno
spivurno / gw-gravity-forms-email-domain-name-validator-usage.php
Last active May 1, 2017 02:34
Gravity Wiz: Ban/Limit Email Domains Usage Examples
<?php
// standard usage
new GWEmailDomainControl(array(
'form_id' => 152,
'field_id' => 9,
'domains' => array('gmail.com', 'hotmail.com', 'test.com')
));
// all options
@zioproto
zioproto / qtranslate_wordpress39.patch
Created April 17, 2014 10:11
Fix qTranslate plugin for Wordpress 3.9
diff --git a/wp-content/plugins/qtranslate/qtranslate_core.php b/wp-content/plugins/qtranslate/qtranslate_core.php
index 17b4669..9ac128a 100644
--- a/wp-content/plugins/qtranslate/qtranslate_core.php
+++ b/wp-content/plugins/qtranslate/qtranslate_core.php
@@ -414,6 +414,7 @@ function qtrans_updateTermLibrary() {
function qtrans_strftime($format, $date, $default = '', $before = '', $after = '') {
// don't do anything if format is not given
+ return $default;
@tatemz
tatemz / docker-wordpress.sh
Last active December 29, 2020 17:25
A quick way to get a WordPress installation up and running with Docker
#!/bin/bash
mkdir wordpress-site && cd wordpress-site
touch docker-compose.yml
cat > docker-compose.yml <<EOL
version: "2"
services:
my-wpdb:
@forgeandsmith
forgeandsmith / Gravity Forms Reset Styles
Last active June 22, 2021 07:33
Gravity Forms SCSS reset styles for easy style editing and management
///////////////////////////////////////////////
////// GRAVITY FORMS RESET STYLES //////
///////////////////////////////////////////////
// These styles are made in mind to be used with SCSS or LESS
// If you use these styles, you must go to the Gravity Forms settings in the WordPress back end and set Output CSS to No.
////----- Core Containers
.gform_heading,
.gform_body,
@yankiara
yankiara / wp-defer-scripts.js
Created January 17, 2020 11:01
Defer enqueued JS scripts in Wordpress
add_filter( 'script_loader_tag', 'yankiara_defer_scripts', 10, 3 );
function yankiara_defer_scripts( $tag, $handle, $src ) {
$defer = array( 'script-handle-1', 'script-handle-2', 'script-handle-3' );
if ( in_array( $handle, $defer ) )
return '<script src="' . $src . '" defer="defer" type="text/javascript"></script>' . "\n";
return $tag;
}
@yankiara
yankiara / fluid-fonts-and-icons.css
Last active July 10, 2021 04:31
Fluid fonts and icons in CSS
body {
--base: 20;
--scale-headings: 1.44;
--scale-mobile: 0.7;
--scale-mobile-headings: 0.4;
--scale-icons: 1.4;
--min-viewport: 480;
--max-viewport: 1600;
--max-size: var(--base);
}
@spivurno
spivurno / gw-gravity-forms-map-fields-to-field.php
Last active May 22, 2023 17:27
Gravity Wiz // Gravity Forms // Map Submitted Field Values to Another Field
<?php
/**
* Gravity Wiz // Gravity Forms // Map Submitted Field Values to Another Field
*
* Usage
*
* 1 - Enable "Allow field to be populated dynamically" option on field which should be populated.
* 2 - In the "Parameter Name" input, enter the merge tag (or merge tags) of the field whose value whould be populated into this field.
*
* Basic Fields
@kshnurov
kshnurov / jquery.photoswipe.js
Created February 23, 2015 23:37
PhotoSwipe: init from DOM using jQuery
(function( $ ) {
$.fn.photoswipe = function(options){
var galleries = [],
_options = options;
var init = function($this){
galleries = [];
$this.each(function(i, gallery){
galleries.push({
id: i,