Skip to content

Instantly share code, notes, and snippets.

@cfxd
cfxd / remove_wp_selfies.php
Last active December 13, 2017 18:15
Remove Existing Self Linking Images ("WP Selfies") in WordPress. See http://cfxdesign.com/remove-existing-self-linking-images-in-wordpress
<?php
function remove_self_linking_images() {
$all_ids = new WP_Query(array(
'post_type' => array('post', 'page'), // feel free to add custom post types here if necessary
'posts_per_page' => -1,
'post_status' => 'any',
'fields' => 'ids'
));
@cfxd
cfxd / gf_bootstrap_input_group_with_addons-with_media_queries.less
Last active August 29, 2015 14:11
Make a Gravity Form with one label, one field, and one button into a Bootstrap input group with addons. Should be used in conjunction with https://gist.github.com/CFXd/53076583ef1fbaaf959e. Second version removes &:extend() to enable use of media queries.
form {
@media (min-width: @screen-md-min) {
.input-group;
.gform_body > ul {
.list-unstyled;
margin: 0;
> li:first-child:last-child {
.input-group;
width: 100%;
> label {
@cfxd
cfxd / package.json
Last active August 29, 2015 14:10
Gulp (and Grunt) by Example. See http://cfxdesign.com/gulp-and-grunt-by-example
"devDependencies": {
"bower": ">=1.3.9",
"gulp": "^3.8.7",
"gulp-autoprefixer": "^0.0.7",
"gulp-clean": "^0.3.1",
"gulp-concat": "^2.3.4",
"gulp-filter": "^0.4.1",
"gulp-grunt": "^0.5.2",
"gulp-imagemin": "^0.6.0",
"gulp-jshint": "^1.8.4",
@cfxd
cfxd / gf.php
Created November 13, 2014 17:49
Populate Gravity Forms in an ACF select field named "subscribe_form_header"
<?php
function populate_gravity_forms($field) {
if(class_exists('RGFormsModel')) {
$forms_array = array();
$forms = RGFormsModel::get_forms(null, 'title');
foreach($forms as $form) {
$forms_array[$form->id] = $form->title;
@cfxd
cfxd / Gruntfile.js
Created November 10, 2014 03:40
WordPress Database Sync (both ways) with Grunt. See http://cfxdesign.com/wordpress-database-sync-with-grunt#update
grunt.initConfig({
mysql: grunt.file.readJSON('mysql.json'),
timestamp: grunt.template.today('mm-dd-yyyy_HH-MM-ss'),
sshexec: {
dump_remote_db: {
options: {
host: '<%= mysql.remote.host %>',
username: '<%= mysql.remote.username %>',
agent: process.env.SSH_AUTH_SOCK
},
@cfxd
cfxd / shortcode.css
Last active November 17, 2021 05:53
How to Make the WordPress Video Shortcode Responsive. See http://cfxdesign.com/how-to-make-the-wordpress-video-shortcode-responsive
.wp-video, video.wp-video-shortcode, .mejs-container, .mejs-overlay.load {
width: 100% !important;
height: 100% !important;
}
.mejs-container {
padding-top: 56.25%;
}
.wp-video, video.wp-video-shortcode {
max-width: 100% !important;
}
<?php
function localize_ajax_variables() {
wp_localize_script('your_js', 'wp_ajax_vars', array(
'admin_url' => admin_url('admin-ajax.php')
));
}
add_action('wp_enqueue_scripts', 'localize_ajax_variables', 999);
/*
*
* Assumes:
* 1. You have a FCF field called 'sections'
* 2. Each FCF block has a text sub field called 'section-title'
*
*/
<?php
@cfxd
cfxd / acf_select_gravity_forms.php
Last active August 15, 2016 04:12
Populate ACF Select Field with Gravity Forms
<?php
function populate_gravity_forms($field) {
echo '<h1>acf/load_field filter debug within populate_gravity_forms()</h1>';
if(class_exists('RGFormsModel')) {
$forms_array = array();
$forms = RGFormsModel::get_forms(null, 'title');
foreach($forms as $form) {
@cfxd
cfxd / disable_gforms_auto_scroll.php
Last active August 29, 2015 14:07 — forked from rutger1140/gist:4994751
Disable auto scrolling of Gravity Forms
<?php
add_filter('gform_confirmation_anchor', '__return_false');
?>