Skip to content

Instantly share code, notes, and snippets.

View Jursdotme's full-sized avatar

Rasmus Jürs Jursdotme

View GitHub Profile
@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());
@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]; ?>">
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 / 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">
@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 / 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 / submenu.php
Last active August 29, 2015 14:02
Wordpress Submenu
<?php
// use wp_list_pages to display Parent page and all child pages.
$ids = get_post_ancestors($page);
$parent = array_pop($ids);
if (empty($parent)) {
$parent = get_the_ID();
}
$args=array(
@Jursdotme
Jursdotme / Isotop.php
Last active August 29, 2015 14:04
Isotope Test Page
<?php
/*
Template Name: Isotope Test
*/
?>
<?php get_header();?>
<div class="container">
<div class="row">
@Jursdotme
Jursdotme / .htaccess
Last active November 11, 2015 08:50
Wordpress htaccess
<ifModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript image/svg+xml
</ifModule>
# BEGIN Expire headers
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 5 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/jpeg "access plus 2592000 seconds"
@Jursdotme
Jursdotme / menu-shortcode.php
Created October 15, 2014 07:36
Shortcode to add menu
// Function that will return our Wordpress menu
function list_menu($atts, $content = null) {
extract(shortcode_atts(array(
'menu' => '',
'container' => 'div',
'container_class' => '',
'container_id' => '',
'menu_class' => 'menu',
'menu_id' => '',
'echo' => true,