Skip to content

Instantly share code, notes, and snippets.

@moyarich
moyarich / auto_add_sidebar_widgets.php
Created February 10, 2015 21:08
Programmatically add wordpress widgets to specific sidebars
/**
* Programmatically add widgets to sidebars
* @param array $add_to_sidebar an array with the name of the sidebar and the widget instance information
* $sidebar_id = 'primary-widget-area';
* $add_to_sidebar[$sidebar_id] = array(
* array(
* 'id_base'=> 'archives',
* 'instance' => array(
* 'title' => 'Archived Content',
* 'dropdown' => 'on',
@moyarich
moyarich / calc-elem.scss
Created August 4, 2012 23:44
using SASS to convert/calculate css sizes from px to em, px to percent and em to px; also has function to remove units / (Design in pixels then convert it to em or percent)
//----- Global variables-------------
$mr-grid-width: 1200px !default; // The wrapper/container size$mr-gutter-width: 20px !default; // The amount of margin between columns
$mr-em-base: 16px !default;
$mr-convert-to: "%" !default;
//----------------------------------
@function -mr-grid-col-width($cols, $grid-width:$mr-grid-width, $grid-total-cols:$mr-grid-total-column, $gutter-width: $mr-gutter-width){
//$cols The number of columns used to create the current elements width.
@return ($grid-width / $grid-total-cols) * $cols - $gutter-width;