Skip to content

Instantly share code, notes, and snippets.

View EvanHerman's full-sized avatar
🐈
Cats, Code, WordPress

Evan Herman EvanHerman

🐈
Cats, Code, WordPress
View GitHub Profile
@kevinwhoffman
kevinwhoffman / style.css
Created June 24, 2018 23:23
Shift Breakpoint of WP List Table
/**
* The layout of a WP List Table typically changes from a multi-column to
* single-column layout when the viewport width is less than or equal to 782px.
* This CSS shifts that breakpoint to 960px for tables with more columns that
* would otherwise become squished if they were all crammed on screen at once.
*/
@media screen and ( max-width: 960px ) {
/* WP List Table Options & Filters */
.tablenav {
@Arjeno
Arjeno / circle.yml
Created August 17, 2016 13:57
Always use the latest version of Chrome on CircleCI
# This makes sure Chrome is always up to date in your test suite
# On average this adds about 10 seconds to your build suite
# Be sure to use Ubuntu 14.04 (Trusty) in the CircleCI's OS setting (Settings > Build Environment)
dependencies:
pre:
- curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- sudo dpkg -i google-chrome.deb
- sudo sed -i 's|HERE/chrome\"|HERE/chrome\" --disable-setuid-sandbox|g' /opt/google/chrome/google-chrome
- rm google-chrome.deb
@EvanHerman
EvanHerman / yikes-easy-forms-for-mailchimp-custom-default-value-tag.php
Last active October 12, 2015 13:40
Add custom tags to the 'pre defined tags' section
<?php
/*
* Add a new custom tag to the 'pre defined tags' section
* @ Change 'tag', 'description' and 'title' to suit your needs.
* @ $available_tags - the default pre-defined tags available out of the box
*/
add_filter( 'yikes-mailchimp-custom-default-value-tags', 'add_new_pre_defined_tags' );
function add_new_pre_defined_tags( $available_tags ) {
// define a new array, with our default tag data (note: to create more than one, simply copy and paste what is below and alter the values)
$available_tags[] = array(
@benlk
benlk / 0-toc.md
Last active March 29, 2023 13:13
Collection of notes on WP_UnitTestCase
  1. Table of contents
  2. General information
    1. Terms
    2. General structure of a test
    3. WordPress-specific assertions and test functions
      • enqueues
      • creating posts
      • creating terms
      • attaching images
  • ?
@mrwweb
mrwweb / truncate_html_string.php
Created July 3, 2014 18:08
Improved version of text-truncating html string function to improve character count accuracy. Code found on oikos.org.uk/2013/02/tech-notes-a-wordpress-excerpt-with-html-tags/.
<?
/**
* Truncates text.
*
* Cuts a string to the length of $length and replaces the last characters
* with the ending if the text is longer than length.
*
* See: oikos.org.uk/2013/02/tech-notes-a-wordpress-excerpt-with-html-tags/
* See also: wpengineer.com/2410/dont-use-strlen/
* See also also: oikos.org.uk/2013/02/tech-notes-a-wordpress-excerpt-with-html-tags/#comment-1467093876
@joncave
joncave / plugin.php
Last active September 21, 2023 17:50
An intentionally vulnerable plugin developed for WordPress plugin author education. http://make.wordpress.org/plugins/2013/04/09/intentionally-vulnerable-plugin/
<?php
/* Plugin Name: Damn Vulnerable WordPress Plugin
* Description: Intentionally vulnerable plugin for plugin author education
* Version: 0.1
* Plugin URI: http://make.wordpress.org/plugins/2013/04/09/intentionally-vulnerable-plugin/
* Author: Jon Cave
* Author URI: http://joncave.co.uk
* License: GPLv2+
*
* DO NOT RUN THIS PLUGIN ON AN INTERNET ACCESSIBLE SITE
@helen
helen / repeatable-fields-metabox.php
Created January 11, 2012 04:42
Repeating Custom Fields in a Metabox
<?
/**
* Repeatable Custom Fields in a Metabox
* Author: Helen Hou-Sandi
*
* From a bespoke system, so currently not modular - will fix soon
* Note that this particular metadata is saved as one multidimensional array (serialized)
*/
function hhs_get_sample_options() {