Skip to content

Instantly share code, notes, and snippets.

@lmeyer
lmeyer / utils.php
Created Apr 9, 2019
VC Autocomplete with multiple ajax sources
View utils.php
<?php
add_filter( 'vc_autocomplete_hdco_featured_featureds_callback', 'get_hdco_autocomplete_featureds', 10, 1 );
function get_hdco_autocomplete_featureds($query) {
$query = sanitize_text_field($query);
$items_array = [];
$args = array(
"post_type" => "post",
"s" => $query
View gist:64ba3b91a236b2ef7dceef6ac248a985
background: linear-gradient(45deg,#f5a04b,#d82873);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
display: inline-block;
View gist:bdae4a8a8242349afb5aa23f418082a0
RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$
RewriteRule ^app/uploads/gravity_forms/(.*)$ /index.php [NC,R=401,L]
@lmeyer
lmeyer / main.sh
Last active Jul 22, 2017
Magento 2 commands
View main.sh
php bin/magento module:status
php bin/magento module:enable Hdco_CatalogSearch
php bin/magento setup:upgrade
php bin/magento setup:di:compile
find pub/static -name js-translation.json -exec rm -rf {} \;
php bin/magento setup:static-content:deploy en_US fr_FR
php bin/magento cache:clean
php bin/magento indexer:reindex
@lmeyer
lmeyer / functions.php
Created Jan 28, 2017
Usage of woocommerce_appointments_time_slots_html filter (display left spaces when no booking)
View functions.php
<?php
add_filter('woocommerce_appointments_time_slots_html', 'idl_woocommerce_appointments_time_slots_html', 10, 8);
function idl_woocommerce_appointments_time_slots_html($slot_html, $slots, $intervals, $time_to_check, $staff_id, $from, $timezone, $appointment) {
if ( empty( $intervals ) ) {
$default_interval = 'hour' === $appointment->get_duration_unit() ? $appointment->get_duration() * 60 : $appointment->get_duration();
$custom_interval = 'hour' === $appointment->get_duration_unit() ? $appointment->get_duration() * 60 : $appointment->get_duration();
if ( $appointment->get_interval_unit() && $appointment->get_interval() ) {
$custom_interval = 'hour' === $appointment->get_interval_unit() ? $appointment->get_interval() * 60 : $appointment->get_interval();
}
@lmeyer
lmeyer / main.scss
Created Oct 25, 2016
Responsive margins and paddings sass mixin
View main.scss
// Sizes
$margin-none: 0;
$margin-sm: 5;
$margin-base: 15;
$margin-lg: 30;
$margin-xl: 50;
$margin-xxl: 100;
$padding-xxl: 100;
@lmeyer
lmeyer / hdco_set_post_metabox_field.php
Last active Oct 14, 2016
Connect Gravity Forms upload field to a Metabox image field
View hdco_set_post_metabox_field.php
<?php
$gravity_form_id = 1; // gravity form id, or replace {$gravity_form_id} below with this number
add_filter( "gform_after_submission_{$gravity_form_id}", 'hdco_set_post_metabox_field', 10, 2 );
function hdco_set_post_metabox_field( $entry, $form ) {
$gf_images_field_id = 18; // the upload field id
$metabox_field_id = 'images_gallery'; // the metabox field id
if( isset( $entry['post_id'] ) ) {
$post = get_post( $entry['post_id'] );
@lmeyer
lmeyer / gist:f506a67462bf7614877a205db431bd55
Created Oct 13, 2016
Make WP Super Cache works with Bedrock
View gist:f506a67462bf7614877a205db431bd55
define( 'WP_CACHE', true );
define( 'WPCACHEHOME', $webroot_dir . '/app/plugins/wp-super-cache/');
@lmeyer
lmeyer / gist:b98bdda9237e43179019c84c9de20771
Created Oct 10, 2016
Javascript page redirection difference
View gist:b98bdda9237e43179019c84c9de20771
// similar behavior as an HTTP redirect
window.location.replace("http://stackoverflow.com");
// similar behavior as clicking on a link
window.location.href = "http://stackoverflow.com";
View blog-categories-for-groups-fr_FR.po
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2015-10-12 19:24+0200\n"
"PO-Revision-Date: 2015-10-12 19:35+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"