Skip to content

Instantly share code, notes, and snippets.

@tcmulder
tcmulder / wp-template-part-shortcode.php
Last active December 20, 2023 18:49
Template Part Shortcode
<?php
//Usage: [include template='template' part='part']
function template_part_shortcode($atts) {
extract(shortcode_atts(array(
'template' => 'templates/parts/page',
'part' => null
), $atts));
ob_start();
get_template_part($template, $part);
@tcmulder
tcmulder / crud-cookies.js
Last active December 20, 2023 18:50
CRUD Cookies
var cookies = {
create: function(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
},
@tcmulder
tcmulder / wp-small-admin-bar.php
Last active December 20, 2023 18:51
Makes the WordPress admin bar small and unobtrusive up in the corner of the screen.
/*
* Mini Admin Bar
* Modified from plugin URI: http://www.netyou.co.il/
* Description: Makes the admin bar a small button on the left and expands on hover.
*/
add_action('get_header', 'my_filter_head');
function my_filter_head() { remove_action('wp_head', '_admin_bar_bump_cb'); }
function my_admin_css() {
@magnificode
magnificode / _part-tabs.scss
Last active January 23, 2017 19:49
Dynamic tabs that switch to an accordion on mobile.
.tabs{
margin: {top:40px;}
&:last-child{
margin: {bottom:80px;}
}
h2{
color: $color-1;
font: {
size: emCalc(36px);
}
@magnificode
magnificode / index.html
Created July 25, 2013 21:04
A CodePen by dommagnifico. Hover Lover - Hover over a thing, so that thing underneith does stuff
<link href='http://fonts.googleapis.com/css?family=Arbutus+Slab' rel='stylesheet' type='text/css'>
<article class="focus__list">
<div class="focus__area--wrap">
<div class="focus__area">
<div class="focus__icon">&amp;</div>
<div class="focus__title">
Ampersand
</div>
</div> <!-- //__area -->