Skip to content

Instantly share code, notes, and snippets.

Michael Silber cfxd

Block or report user

Report or block cfxd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cfxd
cfxd / class-membership.php
Created Feb 15, 2019 — forked from wturnerharris/class-membership.php
Class to make things members-only in WordPress.--This class depends on a custom capability called 'is_approved_member' for user member access and the custom post meta key '_members_only' as a post-level custom field.
View class-membership.php
<?php
/**
* Custom class for WP_Membership routines.
*
*
* @package WP_Membership
* @since WP_Membership 0.1
*/
if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
View _quickview.scss.liquid
#quick-view {
display: flex;
height: 100%;
justify-content: flex-end;
flex-wrap: wrap;
position: relative;
-ms-overflow-style: -ms-autohiding-scrollbar;
.qv-product-images {
width: 60%;
height: auto;
View gist:1e8b929851bbd1dbe008073997008ad3
// Update PHP version when using AMP setup from https://alanthing.com/blog/2014/12/22/os-x-1010-yosemite-local-development-environment-apache-php-and-mysql-homebrew/
$ brew install php72 --with-fpm --without-apache --with-homebrew-curl --with-homebrew-openssl --without-snmp
View filter.php
<?php
/*
* THE FILTER
*
*/
function custom_responsive_image_sizes($sizes, $img_name, $attachment_id) {
$sizes = wp_get_attachment_image_sizes($attachment_id, 'original');
$meta = wp_get_attachment_metadata($attachment_id);
$width = $meta['width'];
View woocommerce_loop-custom.php
<?php
if(!function_exists('wc_get_products')) {
return;
}
$paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1;
$ordering = WC()->query->get_catalog_ordering_args();
$ordering['orderby'] = array_shift(explode(' ', $ordering['orderby']));
$ordering['orderby'] = stristr($ordering['orderby'], 'price') ? 'meta_value_num' : $ordering['orderby'];
View load_existing_product_gallery_into_acf_gallery_field.php
@cfxd
cfxd / keybindings.json
Last active Nov 21, 2017
Visual Studio Code settings
View keybindings.json
// Place your key bindings in this file to overwrite the defaults
[
{ "key": "ctrl+1", "command": "" },
{ "key": "ctrl+2", "command": "" },
{ "key": "ctrl+3", "command": "" },
{ "key": "ctrl+4", "command": "" },
{ "key": "ctrl+5", "command": "" },
{ "key": "ctrl+6", "command": "" },
{ "key": "ctrl+7", "command": "" },
{ "key": "ctrl+8", "command": "" },
View add_initial_file_size_postmeta.php
<?php
// Adds initial meta to each attachment
function add_initial_file_size_postmeta($column_name, $post_id) {
static $query_ran;
if($query_ran !== null) {
$all_imgs = new WP_Query(array(
'post_type' => 'attachment',
'post_status' => 'inherit',
View paginate_links.php
View clearfix-hypo.scss
@media (min-width: $screen-sm-min) and (max-width: $screen-sm-max) {
.your-row-class > *:nth-child(3n+4) {
clear: left;
}
}
You can’t perform that action at this time.