Skip to content

Instantly share code, notes, and snippets.

@cfxd
cfxd / Gruntfile.js
Last active April 24, 2019 03:59
Remove Unused CSS from WordPress Automatically with Grunt. See http://cfxdesign.com/remove-unused-css-from-roots-theme-automatically-with-grunt/
'use strict';
module.exports = function(grunt) {
// Load all tasks
require('load-grunt-tasks')(grunt);
// Show elapsed time
require('time-grunt')(grunt);
var jsFileList = [
'assets/vendor/bootstrap/js/transition.js',
'assets/vendor/bootstrap/js/alert.js',
@cfxd
cfxd / clear_jetpack_published.php
Last active February 21, 2021 18:33
Clear Jetpack's Publicized data to re-Publicize posts. See http://cfxdesign.com/how-to-re-publicize-posts-with-jetpack/
<?php
function clear_jetpack_published() {
if(empty($_REQUEST['post'])) {
wp_die(__('Invalid post ID or action'));
}
global $wpdb;
$id = isset($_REQUEST['post']) ? absint($_REQUEST['post']) : '';
@cfxd
cfxd / remove_cf7_assets-action_hook.php
Last active August 29, 2015 14:04
Load the Contact Form 7 Stylesheet and JavaScript Only When Necessary (the Right Way). See http://cfxdesign.com/load-the-contact-form-7-stylesheet-and-javascript-only-when-necessary/
<?php do_action('cf7_before_wp_head'); ?>
sshexec: {
dump_remote_db: {
options: {
host: '<%= mysql.remote.host %>',
username: '<%= mysql.remote.username %>',
agent: process.env.SSH_AUTH_SOCK
},
command: [
'cd <%= mysql.remote.save_path %>',
'mysqldump <%= mysql.remote.dbname %> -u <%= mysql.remote.dbuser %> -p<%= mysql.remote.dbpass %> > remote-<%= timestamp %>.sql'
function mailpoet_enable_wpmail(){
if(class_exists('WYSIJA')){
$model_config = WYSIJA::get('config','model');
$model_config->save(array('allow_wpmail' => true));
}
}
add_action('init', 'mailpoet_enable_wpmail');

require_short_url: some hosts require short URLs otherwise they redirect to a forbidden page

no_rewrite_wysijap: some hosts don't work with the URL rewriting wysijap/subscription bounce_max**: by default, we handle 100 bounce emails per process, with this option you can increase or decrease this value

urlstats_base64: to deactivate base 64 links

no_js_val: no AJAX subscription

allow_no_js: with Wysija, you can register with or without JavaScript. This option deactivates the JavaScript-less option which can be used by spammers

@cfxd
cfxd / sticky_footer.html
Created September 19, 2014 00:03 — forked from aalaap/gist:3066704
Sticky footer for Bootstrap
@cfxd
cfxd / wp-cli.txt
Last active August 29, 2015 14:06
# Install wordpress
wp core download && wp core config --dbname=wordpress_test_db --dbuser=root && wp core install --url=http://localhost/wp-cli/ --title=Wordpress --admin_user=admin --admin_password=admin --admin_email=youremail@domain.com
# Install and activate Plugins
wp plugin install wordpress-importer --activate && wp plugin install contact-form-7 --activate
# Generate Posts
curl http://loripsum.wpwolf.com | wp post generate --post_content --count=10
# Activate a theme
@cfxd
cfxd / full-width-inline-form.less
Created October 4, 2014 21:41
Bootstrap 3 full width inline form LESS mixin (hack using input group)
.full-width {
& .input-group-btn:last-child > .btn {
margin-left: 5px;
.border-left-radius(@border-radius-base);
}
& .form-control:first-child {
.border-right-radius(@border-radius-base);
}
}
@cfxd
cfxd / gf-inline-form.less
Last active August 29, 2015 14:07
Bootstrap 3 inline form for Gravity Forms (only tested with 1 input field and 1 submit button)
/*
*
* Bootstrap 3 inline form for Gravity Forms
*
* Use with a class assigned to the form
* or on .gform to affect all Gravity forms
*
* Example 1 (affects targeted form class only): .my-form-class { &:extend(.gravity_form_inline all); }
*
* Example 2 (affects all Gravity Forms): .gform { &:extend(.gravity_form_inline all); }