Skip to content

Instantly share code, notes, and snippets.

@fxbenard
fxbenard / getrmpomakemo.sh
Created Mar 5, 2014
Pull translations with Transifex client, create the mo and remove the po
View getrmpomakemo.sh
#! /bin/sh
# Pull all files from Transifex;
# Minimum percentage change to whatever you want
tx pull -a --minimum-perc=100
# Create .mo files from .po files.
# Twisted by WP-Translations.org, created by grappler.
for file in `find . -name "*.po"` ; do msgfmt -o ${file/.po/.mo} $file && rm $file ; done
@cfoellmann
cfoellmann / tribe-events-activation-connector-oop.php
Last active Aug 29, 2015
Auto-(De-)Activate 'The Events Calendar' with 'The Events Calendar Pro' + hide 'The Events Calendar' from plugins.php listing
View tribe-events-activation-connector-oop.php
<?php
class EventsConnector {
var $events_calendar;
public function __construct() {
$this->events_calendar = 'the-events-calendar/the-events-calendar.php';
$events_calendar_pro = WP_PLUGIN_DIR . '/events-calendar-pro/events-calendar-pro.php';
@bradt
bradt / url-coupons.js
Last active Aug 29, 2015
WooCommerce URL Coupons
View url-coupons.js
$( document ).ready( function() {
var cookie_name = 'dbrains-coupon';
var cookie_name_error = 'dbrains-coupon-error';
if ( 'undefined' === typeof $.cookie( cookie_name ) ) {
return;
}
var message = 'The coupon code ' + $.cookie( cookie_name ).toUpperCase() + ' has been successfully applied.';
@fjarrett
fjarrett / gist:2653299
Last active Oct 4, 2015
Add prefixes to WordPress post types when a theme is activated
View gist:2653299
<?php
/* Checks to see if new post type names (with prefixes) are being used. If not, then the old
* post type names are converted as long as there aren't conflicting post type names that are
* being registered by other plugins.
*
* @hook {action} after_setup_theme
*/
function fjarrett_prefix_post_types(){
global $wpdb;
@kingkool68
kingkool68 / Seamless Git Deployment
Last active Dec 17, 2015
To push code changes to text servers I do this.
View Seamless Git Deployment
We have a private Git running on a server somewhere which we consider our central repository. Inside the .git/hooks/post-recieve is the following:
#!/bin/bash
while read oldrev newrev ref
do
branch=`echo $ref | cut -d/ -f3`
if [ "master" == "$branch" ]; then
@mpeshev
mpeshev / theme-review-porto.md
Last active Dec 27, 2015
Theme Review Porto plan
View theme-review-porto.md
@GaryJones
GaryJones / functions.php
Last active Jan 11, 2016
Default styles for HTML5 galleries and captions.
View functions.php
<?php
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );
@ShinichiNishikawa
ShinichiNishikawa / newreview
Last active Jun 26, 2016
Creating a whole new Theme Review environmet in 1 minute using wp-cli
View newreview
wp db reset --yes
wp core install --url=http://theme-review.loc --title="This is a really long long title to check if this theme design doesn't break with the long site title" --admin_user=admin --admin_password=admin --admin_email=example@example.com
wp core update
wp plugin install theme-check debug-bar log-deprecated-notices monster-widget wordpress-importer show-current-template customizer-theme-resizer --activate
wp plugin install wordpress-beta-tester debogger jetpack
wp plugin update --all
wp option update blogdescription "I'm in the theme review process and this is a very very long tagline to see if this long tagline text string in WordPress doesn't break the design of the theme header and else."
wp option update posts_per_page 5
wp option update thread_comments 1
wp option update thread_comments_depth 3
@jgalea
jgalea / microtime.php
Last active Jan 25, 2017
Test execution time of WordPress PHP function
View microtime.php
<?php
function my_function() {
$start = microtime(true);
// function code here
$time_taken = microtime(true) - $start;
wp_die( $time_taken ); // in seconds
}
@hlashbrooke
hlashbrooke / Slack theme for Post Status
Last active May 16, 2017
Slack theme for the Post Status channel. To use this theme, go to the 'Sidebar Theme' tab in your preferences pane and add this text to the custom theme field.
View Slack theme for Post Status
#2E3641,#FC781F,#1088C4,#FFFFFF,#808080,#FFFFFF,#FC781F,#1088C4