Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
👨‍🏭

Jeremy Herve jeherve

🚀
👨‍🏭
View GitHub Profile
@jeherve
jeherve / asynchrone-social.php
Created Jul 7, 2011
Boutons Like et +1 en asynchrone
View asynchrone-social.php
<?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 Jul 23, 2011
fb:image handled by WordPress custom fields
View in-header.php
<?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 Aug 25, 2011
Add schema information to WordPress loop
View single.php
<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 Sep 30, 2011
Add new Google+ field to WordPress profiles
View functions.php
<?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 Oct 5, 2011
Try out at getting layout name in container class
View _layoutsbooks.html
---
layout: layout
---
<div class="{{ post.layout }}">
{{ content }}
</div>
@jeherve
jeherve / functions.php
Created Oct 12, 2011
Add Google +snippets to TwentyTen page template
View functions.php
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 Oct 12, 2011
Add new og:image when using the custom field images plugin
View functions.php
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 Oct 25, 2011
Random static construction landing page
View index.html
<!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 Oct 26, 2011
[WordPress support] mod twentyeleven header Google+1
View header.php
<?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 Dec 16, 2011
[Jekyll] WordPress migration
View migrate.rb
#!/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.
You can’t perform that action at this time.