Skip to content

Instantly share code, notes, and snippets.

View Jursdotme's full-sized avatar

Rasmus Jürs Jursdotme

View GitHub Profile
@Jursdotme
Jursdotme / slugify.php
Created October 16, 2014 11:11
Slugify function
<?php function slugify($text)
{
// replace non letter or digits by -
$text = preg_replace('~[^\\pL\d]+~u', '-', $text);
// trim
$text = trim($text, '-');
// transliterate
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
@Jursdotme
Jursdotme / Email skabelon
Last active August 29, 2015 14:08
Standard Kontaktformular
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
@import url(https://fonts.googleapis.com/css?family=Roboto:400,400italic,700,700italic);
body {
margin: 0;
padding: 0;
@Jursdotme
Jursdotme / acf-functions.php
Last active August 29, 2015 14:09
Add custom field to Relationship field output
<?php function my_acf_relationship_result( $html, $post )
{
// add an image to each result
$field = get_field('varenummer', $post->ID);
if( $field )
{
$html = '<strong>' . $field . '</strong> - ' . $html;
}
@Jursdotme
Jursdotme / contact.php
Created December 19, 2014 08:07
random user
<?php
$json_url = "http://api.randomuser.me/?format=json&results=10";
$json = file_get_contents($json_url);
$links = json_decode($json, TRUE);
foreach($links['results'] as $key=>$val ){
$user_image_large = $val['user']['picture']['large'];
$user_image_medium = $val['user']['picture']['medium'];
$user_image_thumbnail = $val['user']['picture']['thumbnail'];
$user_firstname = ucfirst($val['user']['name']['first']);
$user_lastname = ucfirst($val['user']['name']['last']);
@Jursdotme
Jursdotme / autoFitvidst
Created February 16, 2015 12:12
Automatic fitvids
$(document).ready(function(){
$('iframe[src*="youtube"]').wrap( "<div class='thing-with-video'></div>" );
$('iframe[src*="vimeo"]').wrap( "<div class='thing-with-video'></div>" );
// Target your .container, .wrapper, .post, etc.
$(".thing-with-video").fitVids();
});
@Jursdotme
Jursdotme / Woocommerce Mover.php
Created March 3, 2015 08:30
Woocommerce move template part
// Removes tabs from their original loaction
remove_action( 'HOOK NAME', 'FUNCTION NAME', 10 );
// Inserts tabs under the main right product content
add_action( 'HOOK NAME', 'FUNCTION NAME', 60 );
@Jursdotme
Jursdotme / widget_filters.php
Created May 19, 2016 12:57
Override Pagebuilder Widget template.
<?php
function mytheme_feature_widget_template( $filename, $instance, $widget ){
$filename = get_stylesheet_directory() . '/partials/feature-widget-template.php';
return $filename;
}
add_filter( 'siteorigin_widgets_template_file_secondthought-feature-widget', 'mytheme_feature_widget_template', 10, 3 );
?>
@Jursdotme
Jursdotme / SassMeister-input.scss
Last active April 10, 2017 13:49
Simple menu widget styling
// ----
// libsass (v3.5.0.beta.2)
// ----
.inzite-menu-widget.simple.hierarchy {
a {
text-decoration: none;
}
ul {
list-style: none;
@Jursdotme
Jursdotme / Script.js
Created April 18, 2017 14:05
Smooth scroll vantage
( function($) {
$.fn.vantageSmoothScroll = function () {
$( this ).click( function ( e ) {
var $a = $( this );
var $target = $( '[name=' + this.hash.slice( 1 ) + ']' ).length ? $( '[name=' + this.hash.slice( 1 ) + ']' ) : $( $a.get( 0 ).hash );
if ( $target.length ) {
var height = 0;
if ( $( '#masthead .site-navigation' ).hasClass( 'use-sticky-menu' ) ) {
@Jursdotme
Jursdotme / snippet-1.html
Last active July 19, 2017 09:42
Emmet layout snippets
<!-- html:5>(header.site-header>span.__logo{logo}+nav.__navigation>ul.__navigation-list>li.__navigation-item*3>a.__navigation-link[href="#"]{Menuitem})|bem|c -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>