Skip to content

Instantly share code, notes, and snippets.

View purzlbaum's full-sized avatar

Claudio Schwarz purzlbaum

View GitHub Profile

Atom.io Packages

  • autoclose-html
  • autocomplete-wordpress-hooks
  • editorconfig
  • emmet
  • file-icons
  • fonts
  • git-control
  • highlight-line
@purzlbaum
purzlbaum / content.php
Created July 10, 2015 12:43
Reading Time for WordPress post
<?php
$mycontent = $post->post_content; // wordpress users only
$word = str_word_count( strip_tags( $mycontent ) );
$m = floor( $word / 200 );
$s = floor( $word % 200 / ( 200 / 60 ) );
$estS = $s . ' Sekunde' . ( $s == 1 ? '' : 'n' );
$estMs = $m . ' Minute' . ( $m == 1 ? '' : 'n' ) . ', ' . $s . ' Sekunde' . ( $s == 1 ? '' : 'n' );
?>
@purzlbaum
purzlbaum / customizer.php
Last active March 17, 2024 20:37
Google Font select for WordPress Customizer
<?php
new theme_customizer();
class theme_customizer {
public function __construct() {
add_action( 'customize_register', array(&$this, 'customize_linje' ));
}
/**
* Customizer manager demo
.pullquote
-moz-box-shadow: 0 1px 0 #eeeeee, inset 0 1px 0 #eeeeee
-webkit-box-shadow: 0 1px 0 #eeeeee, inset 0 1px 0 #eeeeee
box-shadow: 0 1px 0 #eeeeee, inset 0 1px 0 #eeeeee
color: #444
border: 0
padding: 1em 0
margin: 1em 1.625em 1em 0
text-align: right
width: 33%
@purzlbaum
purzlbaum / wp-plugins.md
Last active August 29, 2015 14:03
Useful WordPress Plugins
@purzlbaum
purzlbaum / page-sidebars.php
Created February 6, 2014 15:21
Show for each page a sidebar in the WordPress widget section
// Dynamic Widgets
$myPages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'page' OR post_type = 'teams' /* OR post_type = 'players' */ AND post_status = 'publish'");
foreach ($myPages as $q ){
$id = 'sidebar-'.$q->ID;
$namePref = "Parent - ";
if ($q->post_parent != 0){
$namePref = "Child - ";
}
$sbtitle = $q->post_title;
@purzlbaum
purzlbaum / _mixins.sass
Created February 3, 2014 15:19
Some SASS mixins
// Retina ready images
@mixin at2x($image_name, $w: auto, $h: auto, $extention: '.png')
background-image: url($image_name + $extention)
$x2img : $image_name + '@2x' + $extention
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)
background-image: url($x2img)
-webkit-background-size: $w $h
-moz-background-size: $w $h
-o-background-size: $w $h