Skip to content

Instantly share code, notes, and snippets.

View jeherve's full-sized avatar
🚀
👨‍🏭

Jeremy Herve jeherve

🚀
👨‍🏭
View GitHub Profile
@jeherve
jeherve / asynchrone-social.php
Created July 7, 2011 19:26
Boutons Like et +1 en asynchrone
<?php
//Pour Facebook, apres avoir appele FB.init, charger connect js en asynchrone
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : xxx,
session : xxx,
status : true,
cookie : true,
@jeherve
jeherve / in-header.php
Created July 23, 2011 19:11
fb:image handled by WordPress custom fields
<?php if ( get_post_meta($post->ID, 'fbimage', true) ) : ?>
<meta property="og:image" content="<?php echo(get_post_meta($post->ID, "fbimage", true)); ?>" />
<?php endif; ?>
@jeherve
jeherve / single.php
Created August 25, 2011 09:48
Add schema information to WordPress loop
<div itemscope itemtype="http://schema.org/Article" class="content">
<h1 itemprop="name"><?php the_title(); ?></h1>
<div class="entry-content">
<?php
if ( has_post_thumbnail() )
the_post_thumbnail( 'single-post-thumbnail', array( 'itemprop' => 'image' ) );
else
echo '<img src="' . get_bloginfo( 'stylesheet_directory' ) . '/images/default_thumb1.jpg" class="attachment wp-post-image" />';
@jeherve
jeherve / functions.php
Created September 30, 2011 11:35
Add new Google+ field to WordPress profiles
<?php
/*
* Add Google field to WordPress profile
* Kudos to Justin Tadlock
* http://justintadlock.com/archives/2009/09/10/adding-and-using-custom-user-profile-fields
*/
// Display the new field
function werewp_googleplus_field( $user ) { ?>
<h3>Extra profile information</h3>
@jeherve
jeherve / _layoutsbooks.html
Created October 5, 2011 06:09
Try out at getting layout name in container class
---
layout: layout
---
<div class="{{ post.layout }}">
{{ content }}
</div>
@jeherve
jeherve / functions.php
Created October 12, 2011 07:10
Add Google +snippets to TwentyTen page template
function werewp_image_plus($html, $id , $class){
$html = str_replace('class="'.$class.'"','itemprop="image" class="'.$class.'"',$html);
return $html;
}
add_filter('get_image_tag','werewp_image_plus',10,4);
@jeherve
jeherve / functions.php
Created October 12, 2011 20:04
Add new og:image when using the custom field images plugin
function werewp_ogimage() {
$customimage = get_custom_field_image();
echo '<meta property="og:image" content="'.$customimage.'" />';
}
add_action( 'wp_head', 'werewp_ogimage' );
@jeherve
jeherve / index.html
Created October 25, 2011 13:31
Random static construction landing page
<!doctype html>
<html>
<head>
<title>Not ready yet, come back later!</title>
<script src="/mint/?js"></script>
<style type="text/css">
html { background: #fff url(http://farm3.static.flickr.com/2059/2342058776_a23acd225d_o.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; height: 100% }
</style>
</head>
<body>
@jeherve
jeherve / header.php
Created October 26, 2011 14:21
[WordPress support] mod twentyeleven header Google+1
<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till <div id="main">
*
* @package WordPress
* @subpackage Twenty_Eleven
* @since Twenty Eleven 1.0
*/
@jeherve
jeherve / migrate.rb
Created December 16, 2011 18:40
[Jekyll] WordPress migration
#!/usr/bin/env ruby
# Input: WordPress XML export file.
# Outputs: a series of Textile files ready to be included in a Jekyll site,
# and comments.yml which contains all approved comments with metadata which
# can be used for a Disqus import.
# Credits: @ecerulm https://gist.github.com/500506
# Changes from the original gist: http://gist.github.com/268428
# 1. Handles titles containing special characters. Those have to be YAML escaped
# 2. Use the original permalinks in wordpress.