Skip to content

Instantly share code, notes, and snippets.

View m-e-h's full-sized avatar
😐
>_

Marty Helmick m-e-h

😐
>_
View GitHub Profile
@m-e-h
m-e-h / package.json
Last active March 12, 2018 20:15
starter package.json
{
"name": "abc",
"version": "1.0.0",
"description": "A starter theme for WordPress.",
"main": "index.js",
"scripts": {
"build": "npm-run-all --parallel scss:compile js:build --sequential css:prefix css:minify",
"dev": "npm-run-all --parallel css:watch js:watch",
"scss:compile": "node-sass --output-style expanded resources/styles -o resources/dist/styles",
"css:prefix": "postcss -u autoprefixer -r resources/dist/styles/*",
@m-e-h
m-e-h / members-tax.php
Last active September 22, 2017 21:38
Map taxonomy terms to Members roles
<?php
add_filter( 'members_can_user_view_post', 'smcs_tax_content_permissions' );
function smcs_tax_content_permissions( $can_view, $user_id, $post_id ) {
$terms = get_terms( array(
'taxonomy' => 'smcs_access',
) );
if ( ! empty( $terms ) ) {
@m-e-h
m-e-h / html-atts.php
Last active July 7, 2017 18:40
filter hybrid_attr to consolidate adding class selectors into an array
<?php
/**
* Overwrite html class selectors.
*
* @package Abraham
*/
/**
* Overwrite html class selectors.
*
{
"name": "_s",
"version": "1.0.0",
"scripts": {
"scss": "node-sass --include-path scss sass/style.scss style.css --output-style=expanded --indent-type=tab --indent-width=1",
"autoprefixer": "postcss style.css -u autoprefixer -o style.css --no-map",
"stylelint": "stylelint 'style.css'",
"stylefix": "stylelint 'style.css' --syntax scss --fix",
"scsslint": "stylelint 'sass/**/*.scss'",
"scssfix": "stylelint 'sass/**/*.scss'",
@m-e-h
m-e-h / font-loader.php
Last active October 26, 2017 14:43
WP FontFaceObserver
<?php
/**
* Better font loading.
*/
add_action( 'wp_enqueue_scripts', 'abe_font_scripts' );
add_action( 'wp_head', 'abe_display_font' );
/**
* Enqueue scripts and styles.
*/
@m-e-h
m-e-h / Responsive-embed.css
Last active April 22, 2018 14:14
Responsive video embeds for WP
/**
* Flexible media embeds
*
* For use with media embeds – such as videos, slideshows, or even images –
* that need to retain a specific aspect ratio but adapt to the width of their
* containing element.
*
* Based on: http://alistapart.com/article/creating-intrinsic-ratios-for-video
*/
@m-e-h
m-e-h / keybase.md
Last active October 31, 2016 18:23

Keybase proof

I hereby claim:

  • I am m-e-h on github.
  • I am marty (https://keybase.io/marty) on keybase.
  • I have a public key whose fingerprint is 6CFA 69B1 E531 5D22 ED81 7670 60BC CAA2 9C94 BC3B

To claim this, I am signing this object:

@m-e-h
m-e-h / wp-nav-classes.php
Created May 7, 2016 18:34
Custom class selectors for WP nav items
<?php
/**
* Class selectors added to the menu item's <li> element.
*/
function menu_item( $attr, $item ) {
return $attr;
}
add_filter( 'nav_menu_css_class', 'menu_item', 10, 2 );
@m-e-h
m-e-h / gv-container-class.php
Last active August 31, 2015 18:45 — forked from luistinygod/grid-view.php
GravityView: Convert a list view into a grid style (3-col)
<?php
/**
* Add the `gv-grid` class to the list container
*/
function my_gv_list_container( $classes ) {
return $classes . ' gv-grid';
}
add_filter( 'gravityview/render/container/class', 'my_gv_list_container', 10, 1 );
/**
@m-e-h
m-e-h / multiple-roles-per-user.php
Last active August 27, 2015 20:15 — forked from jemoreto/multiple-roles-per-user.php
Multiple roles per user WordPress plugin. Working when creating a new user and editing an user. Thanks to nikolov-tmw (https://goo.gl/Xv563d) and evankennedy (https://goo.gl/sh2sX6).
/**
* Plugin Name: Multiple Roles per User
* Description: Allows anyone who can edit users to set multiple roles per user. In a default WordPress environment that wouldn't have much of an effect, since the user would have the privileges of the top-privileged role that you assign to him. But if you have custom roles with custom privileges, this might be helpful.
* Version: 1
* Author: nikolov.tmw
* Author URI: http://paiyakdev.com/
* License: GPL2
*/
/*
Copyright 2013 Nikola Nikolov (email: [email protected])