Skip to content

Instantly share code, notes, and snippets.

Avatar

Claudio Schwarz purzlbaum

View GitHub Profile
View atom-recommendations.md

Atom.io Packages

  • autoclose-html
  • autocomplete-wordpress-hooks
  • editorconfig
  • emmet
  • file-icons
  • fonts
  • git-control
  • highlight-line
@purzlbaum
purzlbaum / content.php
Created Jul 10, 2015
Reading Time for WordPress post
View content.php
<?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 Aug 4, 2022
Google Font select for WordPress Customizer
View customizer.php
<?php
new theme_customizer();
class theme_customizer {
public function __construct() {
add_action( 'customize_register', array(&$this, 'customize_linje' ));
}
/**
* Customizer manager demo
View external-link-style.css
View pullquote.sass
.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 Aug 29, 2015
Useful WordPress Plugins
View wp-plugins.md
@purzlbaum
purzlbaum / page-sidebars.php
Created Feb 6, 2014
Show for each page a sidebar in the WordPress widget section
View page-sidebars.php
// 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;
View _mixins.sass
// 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