Skip to content

Instantly share code, notes, and snippets.

@bearded-avenger
bearded-avenger / layout.md
Last active August 29, 2015 14:07
Takeover Layout Methods in WordPress

I have a WordPress plugin that runs as a custom post type. It creates a special layout that's used together with Aesop Story Engine to allow quick and unique story creation. The alpha version of this is done with template_include to override a single post type story template.

Because of the unique and particular layout of the story, I need to ensure that no other assets are being loaded on these specific story pags, and preferrably no markup as well. The alpha version does this by building up it's own template, consequently removing wp_head and wp_footer all together.

This plus side of this, is that special layout and design are guarnateed to work with any theme or plugin. The page only loads 2 files, the files necessary to work. The header http://cl.ly/image/2D1o0l071z2a and footer http://cl.ly/image/2D1o0l071z2a are clean.

The downside of this, is that other plugins won't work on the specially designed story pages without hooking into the specific hooks available in teh story page.

  1. Is the fact that o
@bearded-avenger
bearded-avenger / menu.js
Created October 22, 2014 18:24
Simple off-canvas menu
jQuery(document).ready(function($){
$('a').click(function(e){
e.preventDefault()
$('body').toggleClass('menu-open');
});
});
@bearded-avenger
bearded-avenger / blur.less
Created October 27, 2014 13:20
CSS Blur - No IE Support
.abs-pos-img-div {
position: absolute;
top:0;
left:0;
width:100%;
height:100%;
background-size:cover;
background-position:center center;
z-index: 0;
.translate3d(0, 0, 0);
add_shortcode('ideas','ideas_shortcode');
function ideas_shortcode(){
ob_start();
$args = array(
'post_type' => 'ideas',
'posts_per_page' => -1
);
$q = new WP_Query($args);
@bearded-avenger
bearded-avenger / mixin.less
Created February 22, 2015 14:49
Grid Layout - CSS - nth child
// this targets 1,5,7,11,13,17,19...
.ale--66 {
&:nth-child(6n+1),
&:nth-child(6n+5){
width:66.666%;
}
}
// this targets - 2,4,8,10,14,16,20....
.ale--33 {
.lead {
font-size: 1.3em;
font-weight: 200;
line-height: 1.6;
&.dropcap:first-letter {
float: left;
font-size: 3.4rem;
line-height: 2rem;
padding-top: 1.2rem;
@bearded-avenger
bearded-avenger / social.php
Last active August 29, 2015 14:16
dead-simple-social-shit-4000-super-duper-beards-with-goats.php
<?php
/**
*
* This class holds all teh functionality for social sharing and social data so you dont need a plugin
* Ex: https://lasso.is/now-entering-the-arena/ (bottom)
*
* use social sharing like so:
* <a href="#" class="post-share__twitter">share twitter</a>
* <a href="#" class="post-share__fb">share fb</a>
@bearded-avenger
bearded-avenger / lasso-sample-meta-plugin.php
Last active August 29, 2015 14:22
lasso sample meta plugin
<?php
/**
* Plugin Name: Lasso Sample Settings Addon
*
*/
add_filter('lasso_modal_tabs','try_tabs');
function try_tabs( $tabs ){
$tabs[] = array(
/**
* Gets a number of posts and displays them as options
* @param array $query_args Optional. Overrides defaults.
* @return array An array of options that matches the CMB options array
*/
function cgc_get_posts_for_cmb( $query_args ) {
$args = wp_parse_args( $query_args, array(
'post_type' => array('post'),
'numberposts' => -1,
@bearded-avenger
bearded-avenger / gist:6540945
Last active December 22, 2015 22:38
Last Updated Shortcode
add_shortcode('last_updated','53fh26_lastupdated');
function 53fh26_lastupdated($atts,$content = null){
$updated = get_the_modified_date('F j, Y');
$out = sprintf('<p class="last-updated">Last Updated: %s</p>',$updated);
return $out;
}
// Usage