Skip to content

Instantly share code, notes, and snippets.

View mngarwood's full-sized avatar

Megan Garwood mngarwood

View GitHub Profile
@redoPop
redoPop / .gitignore
Created June 18, 2010 22:08
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@marcedwards
marcedwards / high-dpi-media.css
Last active March 2, 2025 20:24
A CSS media query that captures almost all high DPI aware devices.
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
@zakhardage
zakhardage / Shopify Random Product Order
Last active February 23, 2023 07:47
Random Product Order in Shopify
<script type="text/javascript">
function fisherYates ( myArray ) {
var i = myArray.length, j, temp;
if ( i === 0 ) return false;
while ( --i ) {
j = Math.floor( Math.random() * ( i + 1 ) );
temp = myArray[i];
myArray[i] = myArray[j];
myArray[j] = temp;
}
@macbleser
macbleser / wp-permissions-script
Created February 21, 2014 15:37
WordPress Permissions Configuration Script
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro
#
WP_OWNER=changeme # &lt;-- wordpress owner
WP_GROUP=changeme # &lt;-- wordpress group
WP_ROOT=/home/changeme # &lt;-- wordpress root directory
@amdrew
amdrew / gist:4921c54cbcb94d2ed44e
Created May 5, 2014 01:10
Easy Digital Downloads - Manual Purchases. Create a new user account when making a manual payment
<?php
function sumobi_eddmp_create_payment( $data ) {
if ( wp_verify_nonce( $data['edd_create_payment_nonce'], 'edd_create_payment_nonce' ) ) {
// email address of user
$email_address = $data['user'];
// check to see if a user account doesn't already exist with email address
$user_id = username_exists( $email_address );
@robincornett
robincornett / functions-01.php
Last active November 27, 2017 08:25
Responsive menus for HTML5 Genesis themes. with updating skip links. The skip links must follow the pattern established in Genesis core.
<?php
//do not include the opening tag!
// Required Scripts and Styles
add_action( 'wp_enqueue_scripts', 'leaven_load_scripts', 15 );
function leaven_load_scripts() {
// Responsive Navigation
wp_enqueue_style( 'fontawesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', array(), '4.3.0' );
@stmswitcher
stmswitcher / codecept.random.option.select.php
Last active February 11, 2023 05:40
Select random option for Codeception
$options = $I->grabMultiple('#selectID option', 'value');
$I->selectOption('select', $options[array_rand($options)]);
@iandunn
iandunn / phpmailer-send-via-mail.php
Created August 17, 2016 19:26
Disable PHPMailer sending via SMTP, so that MailCatcher can catch outbound messages from dev environments
/**
* Configure PHPMailer to send via PHP's mail()
*
* @param PHPMailer $phpmailer
*/
function phpmailer_send_via_mail( $phpmailer ) {
$phpmailer->IsMail();
}
add_action( 'phpmailer_init', 'phpmailer_send_via_mail', 999 );
@robneu
robneu / facet-wp-infinite-scroll.js
Last active October 9, 2021 22:26
Infinite scroll for FacetWP
/* globals FWP */
/**
* JavaScript for FacetWP Infinite Scroll
*/
(function( $ ) {
'use-strict';
var throttleTimer = null;
var throttleDelay = 100;
@dasbairagya
dasbairagya / functions.php
Last active July 17, 2023 04:17
Add a WYSIWYG Field to WooCommerce Product Category Page
<?php
/********************************************Add a custom filed in the categoy*************************/
add_action( 'init', 'wpm_product_cat_register_meta' );
/**
* Register details product_cat meta.
*
* Register the details metabox for WooCommerce product categories.
*
*/
function wpm_product_cat_register_meta() {