Skip to content

Instantly share code, notes, and snippets.

View Jursdotme's full-sized avatar

Rasmus Jürs Jursdotme

View GitHub Profile
@Jursdotme
Jursdotme / db.php
Created May 21, 2014 11:46
Use Live database on local Wordpress install.
// Use live database on local installation
<?php
// paste this in a (new) file, wp-content/db.php
add_filter ( 'pre_option_home', 'test_localhosts' );
add_filter ( 'pre_option_siteurl', 'test_localhosts' );
@Jursdotme
Jursdotme / block-grid.scss
Last active January 21, 2021 17:03
Foundation 5 style Block-Grid for Bootstrap 3 (SASS Version)
// Block Grid
// Technique adapted from Foundation 5 for Bootstrap 3.
// https://github.com/zurb/foundation/blob/f755d8704123f86c281ede0b171881e2672f150d/scss/foundation/components/_block-grid.scss
// Original LESS Version by Christopher Mitchell (https://gist.github.com/ChrisTM)
// Converted to SCSS by Rasmus Jürs (https://github.com/Jursdotme)
[class*="block-grid-"] {
display: block;
margin: -($grid-gutter-width/2);
padding: 0;
@Jursdotme
Jursdotme / isotope-demo.php
Created April 23, 2014 12:56
Isotope setup for Toro
<?php
/*
Template Name: Isotope Test
*/
?>
<?php get_header();?>
<div class="container">
<div class="row">
add_action('after_setup_theme','themename_bw_size');
function themename_bw_size() {
add_image_size('themename-bw-image', 100, 100, true);
}
add_filter('wp_generate_attachment_metadata','themename_bw_filter');
function themename_bw_filter($meta) {
$file = wp_upload_dir();
$file = trailingslashit($file['path']).$meta['sizes']['themename-bw-image']['file'];
list($orig_w, $orig_h, $orig_type) = @getimagesize($file);
@Jursdotme
Jursdotme / ACF Image Output
Created April 16, 2014 07:03
ACF Image Output
<?php
// Setup Image data
$id = get_field('topbillede');
$size = 'full'; // (thumbnail, medium, large, full or custom size)
$image_attributes = wp_get_attachment_image_src( $id, $size );
?>
<img src="<?php echo $image_attributes[0]; ?>" width="<?php echo $image_attributes[1]; ?>" height="<?php echo $image_attributes[2]; ?>">
@Jursdotme
Jursdotme / Responsive Height Fixer
Created May 13, 2013 10:41
This little script hels you controle heights on objects in responsive designs.
var highest = 0;
function sortNumber(a,b) {
return a - b;
}
function maxHeight() {
var heights = new Array();
$('.fixheight>li').each(function(){
$(this).css('height', 'auto');
heights.push($(this).height());