Skip to content

Instantly share code, notes, and snippets.

@richardmtl
richardmtl / functions.php
Created January 31, 2014 18:53 — forked from kraftbj/functions.php
Make homepage og:image be an image from the latest post
<?php
function fb_home_image( $tags ) {
if ( is_home() ) {
$latest_post = get_posts("post_type=post&numberposts=1");
$latest_post = $latest_cpt[0]->ID;
if ( class_exists( 'Jetpack_PostImages' ) ) {
$post_images = Jetpack_PostImages::get_images( $latest_post, array( 'width' => 200, 'height' => 200 ) );
if ( $post_images && !is_wp_error( $post_images ) ) {
$image = array();
@richardmtl
richardmtl / gist:8060045
Last active December 31, 2015 23:29
Remove link on Jetpack Facebook Like Box widget title; edit plugin here: http://plugins.trac.wordpress.org/browser/jetpack/trunk/modules/widgets/facebook-likebox.php#L75
if ( ! empty( $title ) ) :
echo $before_title;
echo esc_html( $title );
echo $after_title
endif;