Skip to content

Instantly share code, notes, and snippets.

View purzlbaum's full-sized avatar

Claudio Schwarz purzlbaum

View GitHub Profile
@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

Atom.io Packages

  • autoclose-html
  • autocomplete-wordpress-hooks
  • editorconfig
  • emmet
  • file-icons
  • fonts
  • git-control
  • highlight-line
@purzlbaum
purzlbaum / watson_google_font
Created January 23, 2014 13:48
Watson Google Font
<link href='http://fonts.googleapis.com/css?family=Tinos:400italic|Gudea:400,700,400italic' rel='stylesheet' type='text/css'>
@purzlbaum
purzlbaum / share
Created January 17, 2014 19:14
HTML and PHP to include the share functions of Facebook, Twitter, Google+ and Pinterest (without counter)
<?php
$largeImageUrl = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large');
?>
<div class="sharebuttons">
<div class="sharing">
<h3>Sharen</h3>
<ul>
<li class="facebook">
<a title="Bei Facebook empfehlen" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo urlencode(get_permalink($post->ID)); ?>&t=<?php echo rawurlencode(strip_tags(get_the_title())) ?>" target="blank" rel="nofollow"><span class="genericon genericon-facebook"></span><span class="network">Facebook</span><span class="count">(<?php echo get_likes(urlencode(get_permalink($post->ID))); ?>)</span></a>
</li>
@purzlbaum
purzlbaum / get_social_counts
Created January 17, 2014 19:13
Get social counts of Facebook, Twitter, Google+ and Pinterest
<?php
function get_tweets($url) {
$json_string = file_get_contents('http://urls.api.twitter.com/1/urls/count.json?url=' . $url);
$json = json_decode($json_string, true);
return intval( $json['count'] );
}
function get_likes($url) {
$json_string = file_get_contents('http://graph.facebook.com/?ids=' . $url);
@purzlbaum
purzlbaum / custom_post_type_blog.php
Last active December 26, 2015 23:59
Custom Post Type Blog
<?php
if ( ! function_exists('custom_post_type_blog') ) {
// Register Custom Post Type
function custom_post_type_blog() {
$labels = array(
'name' => _x( 'Blogs', 'Post Type General Name', '' ),
'singular_name' => _x( 'Blog', 'Post Type Singular Name', '' ),
'menu_name' => __( 'Blog', '' ),
'parent_item_colon' => __( '', '' ),
@purzlbaum
purzlbaum / functions.js
Last active December 26, 2015 18:09
Fügt den SRF Player zu fitvids.js hinzu.
jQuery(".your-container").fitVids({ customSelector: "iframe[src^='http://www.srf.ch/player']"});
@purzlbaum
purzlbaum / add_google_fonts.php
Last active December 21, 2015 06:48
Adding google fonts only if not on a .loc/.local domain
/**
* Adding google fonts only if not on a .loc/.local domain
*
* This is the proper code to add google fonts
* as seen in TwentyTwelve
* Code partially from: https://github.com/wearerequired/required-foundation
*/
if(strpos(!$_SERVER['SERVER_NAME'], '.loc')){
$protocol = is_ssl() ? 'https' : 'http';
$query_args = array( 'family' => 'Gentium+Book+Basic:400,400italic,700|Open+Sans' );
@purzlbaum
purzlbaum / style.sass
Created August 5, 2013 07:30
Attaches a external class to all links outside the domain. I got the code from: http://codegrad.hub.ph/marking-external-links-icon-wordpress/ and I extended it through line 14. The only thing you have to do: search a external link icon. You can find a good one on genericon.com.
/* external links
a.external
background: url('../images/external_link.png') no-repeat right 0px