Skip to content

Instantly share code, notes, and snippets.

@pbrocks
pbrocks / install-phpcs-with-homebrew.md
Last active December 22, 2023 08:16
Install phpcs with Homebrew

Install phpcs with Homebrew

To set up php linting, you’ll want to install this PHP CodeSniffer repo and configure with this WordPress Coding Standards repo: . There are a number of ways to do this, whether direct download, Composer, Homebrew, Pear, etc. The following is what works for me on MacOS using Homebrew:

In a terminal window on your Mac, start by updating your Homebrew.

brew doctor

Then install the Code Sniffer:

@kingkool68
kingkool68 / use-remote-media.php
Last active March 24, 2024 11:37
Check if a local file exists in the WordPress media library and if it doesn't exist, replace the URL with a different URL. Helpful when working with a local site that doesn't have all of the media downloaded as the production site. See https://localwp.com/community/t/proxying-requests-to-wp-content-uploads-to-a-production-site/15701
<?php
// Put this in wp-config.php and replace https://example.com/ with the URL of the production site.
define( 'RH_USE_REMOTE_MEDIA_URL', 'https://example.com/' );
// Put the rest of this in functions.php or a custom plugin or somewhere else.
if ( defined( 'RH_USE_REMOTE_MEDIA_URL' ) && ! empty( RH_USE_REMOTE_MEDIA_URL ) ) {
add_filter( 'wp_get_attachment_image_src', 'filter_wp_get_attachment_image_src' );
add_filter( 'wp_calculate_image_srcset', 'filter_wp_calculate_image_srcset' );
add_filter( 'wp_get_attachment_url', 'filter_wp_get_attachment_url' );
}
@cdils
cdils / bbpress.scss
Last active January 21, 2019 21:21
This is quick, sassified version of the default bbPress stylesheet. I did not sassify the media queries at this point (I intend to re-work those as mobile-first for my project). Also note that I kept the original stylesheet organization. There's repition of some selectors that could be avoidded if the current organization was disregarded. :) As …
/**
* bbPress specific CSS
*
* @package bbPress
* @subpackage Theme
*/
/* =bbPress Style
-------------------------------------------------------------- */
@johnbillion
johnbillion / wp_mail.md
Last active January 27, 2024 14:06
WordPress Emails

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This documentation has moved here: https://github.com/johnbillion/wp_mail

@MurtzaM
MurtzaM / preventNonBusinessEmailSubmission.js
Created September 9, 2014 23:49
This script will prevent Marketo form submission if a user enters a non-business email (Gmail, Hotmail, etc.)
//This script prevents Marketo form submission if a user enters non-business email (Gmail, Hotmail, Yahoo, etc.)
//It will work on any page with a Marketo form, and runs when the form is ready
//For further info, please see Marketo form documentation, http://developers.marketo.com/documentation/websites/forms-2-0/
//Prepared by Ian Taylor and Murtza Manzur on 9/9/2014
<script>
(function (){
// Please include the email domains you would like to block in this list
var invalidDomains = ["@gmail.","@yahoo.","@hotmail.","@live.","@aol.","@outlook."];