Skip to content

Instantly share code, notes, and snippets.

View torbentschechne's full-sized avatar

Torben Tschechne torbentschechne

View GitHub Profile
/* font size & line height in px */
$font-size-body-px: 14;
$line-height-px: 21;
/* calculate font-size (in %) and line-height (in em) */
$font-size-body: pc($font-size-body-px, 16);
$line-height: em($line-height-px, $font-size-body-px);
//Remove Post info & Post Title
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
remove_action( 'genesis_entry_header', 'genesis_post_info', 12);
// Add the Post Info & Post Title in different order
add_action( 'genesis_entry_header', 'genesis_post_info');
add_action( 'genesis_entry_header', 'genesis_do_post_title' );
function custom_remove_image_from_features() {
remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
if ( in_array( 'feature', get_post_class() ) ) {
@torbentschechne
torbentschechne / gist:db9d9765b5b6aeed1e7a
Last active August 29, 2015 14:17
Genesis - one pager full width custom template
<?php
/*
* Template Name: Frontpage
*/
//http://www.billerickson.net/full-width-landing-pages-in-genesis/
/* Main Content */
function custom_content() {
genesis_markup( array(
@torbentschechne
torbentschechne / archive-product.php
Created January 6, 2017 14:52
WooCommerce - Nested Category/Subcategory Layout
<?php
/**
* The Template for displaying product archives, including the main shop page which is a post type archive
*
* This template can be overridden by copying it to yourtheme/woocommerce/archive-product.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@torbentschechne
torbentschechne / gist:6bae7b9853112af03fe1e83227511e16
Created January 12, 2017 20:05
Vimeo - Full-width background wrapper
<div class="iframe-wrapper">
<iframe src="https://player.vimeo.com/video/123456789?autoplay=1&loop=1&byline=0&title=0">
</div>
/* Makes a fixed background wrapper
which the user cannot interact with */
.iframe-wrapper {
position: fixed;
top: 0;
@torbentschechne
torbentschechne / gist:6d0be285cdd6fd16af7d1b45ac52c178
Last active March 2, 2017 08:34
Shopware 5.2 - register cron with plugin
/**
* Valid for SW 5.2 - 5.2.14
* Since 5.2.15 cronjob.xml can be used https://developers.shopware.com/developers-guide/plugin-system/#plugin-cronjob
*/
public static function getSubscribedEvents() {
return [
'Shopware_CronJob_ReminderMail' => 'onCronRun'
];
}
$params = array(
'credentials' => array(
'key' => 'AKIAI*****',
'secret' => 'tbgFh*****',
),
'region' => 'eu-west-1', // < your aws from SNS Topic region
'version' => 'latest'
);
/** @var SnsClient $sns */
@torbentschechne
torbentschechne / gist:426b47f4d3c86e8416d866f443c0f59e
Created March 8, 2018 08:23
301 Redirect from http to https
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{HTTP_HOST}/%{REQUEST_URI} [L,R=301]
</IfModule>
@torbentschechne
torbentschechne / gist:ed8435a860073525488adeeb2f4e08c8
Created March 14, 2018 16:59
VueJs - Create & download a CSV file
//CSV contents must be in response.data.data
invoiceApi.createExport(this.dateFrom.picker, this.dateTo.picker).then(response => {
if (response.data.success == true) {
let blob = new Blob([response.data.data], {type: 'text/csv'});
let link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
link.download = 'FileName_'+this.dateFrom.picker+'_'+this.dateTo.picker+'.csv';
link.click();
this.createExportLoading = false;
@torbentschechne
torbentschechne / gist:a7a7b16c0df57ec4091968b425a9c4e5
Created March 17, 2018 21:14
WooCommerce - free shipping notice
function free_shipping_cart_notice_zones() {
global $woocommerce;
// Get Free Shipping Methods for Rest of the World Zone & populate array $min_amounts
$default_zone = new WC_Shipping_Zone(0);
$default_methods = $default_zone->get_shipping_methods();
foreach( $default_methods as $key => $value ) {
if ( $value->id === "free_shipping" ) {