Skip to content

Instantly share code, notes, and snippets.

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

Jeremy Herve jeherve

🚀
👨‍🏭
View GitHub Profile
@jeherve
jeherve / plugin.php
Last active July 9, 2022 14:41
Traktivity plugin: shortcode to display tv shows and movies watched in the 7 days prior to a given date. https://wordpress.org/support/topic/using-trackt-details-on-frontend/
<?php
/**
* Plugin Name: Weekly Traktivity shortcode
* Plugin URI: https://wordpress.org/support/topic/using-trackt-details-on-frontend/
* Description: A shortcode to display tv shows and movies watched in the 7 days prior to a given date.
* Author: Jeremy Herve
* Version: 1.0.0
* Author URI: https://jeremy.hu
* License: GPL2+
*/
@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 / plugin.php
Created August 17, 2013 18:33
[Jetpack] Use photon to serve Post thumbnails, with custom cropping, and a different cropping on single pages:
<?php
if( function_exists( 'jetpack_photon_url' ) ) {
add_filter( 'jetpack_photon_url', 'jetpack_photon_url', 10, 3 );
}
function jeherve_display_custom( $content, $post ) {
global $post;
// If you didn't define a post thumnail, let's forget about all this
if ( !has_post_thumbnail( $post->ID ) )
@jeherve
jeherve / plugin.php
Last active September 30, 2021 10:31
Remove state field from woocommerce checkout form.
<?php
/**
* Remove state field from woocommerce checkout form.
*
* @see https://github.com/woocommerce/woocommerce/blob/3.1.2/includes/class-wc-countries.php#L629
*
* @param array $fields Array of default address fields.
*/
function jeherve_remove_state_field( $fields ) {
unset( $fields['state'] );
@jeherve
jeherve / jetpack-feature-list-20200309.md
Last active April 16, 2021 10:02
[Jetpack] List of features as of March 9, 2020

Jetpack Feature list as of May 13, 2020

Feature Name Requires Connection to WordPress.com Description Activated for you when you first connect the plugin to WordPress.com
Ads Yes Run ads via the WordPress.com Ad network No
Asset CDN No Serve static files (from Core, Jetpack, and WooCommerce) from our CDN. No
Backups and Scanning Yes Daily or real-time backups and automated virus scanning and threat detection. All happens on WordPress.com No
Blocks Yes/No Add 27 blocks to the editor. Some rely on the WordPress.com infrastructure, others don't Yes
Beautiful Math No Use the LaTeX markup language to write mathematical equations and formulas No
Carousel No Carousel display on galleries and single images No
@jeherve
jeherve / debug-wordpress.md
Last active April 12, 2021 11:08
How To: Enable Debugging in WordPress

Enable Debugging in WordPress

To enable debugging in WordPress, you will need to add the following to your site's wp-config.php file:

define( 'WP_DEBUG', true );

if ( WP_DEBUG ) {
	@error_reporting( E_ALL );
	@ini_set( 'log_errors', true );
@jeherve
jeherve / plugin.php
Last active April 4, 2021 04:46
[Post Views For Jetpack] Display a Stats counter at the top of every post, with a "Views:" heading.
<?php
/**
* Display a Stats counter at the top of every post, with a "Views:" heading.
* @see https://wordpress.org/support/topic/page-views-off/
*
* @param string $content Post content.
*/
function jeherve_custom_display_post_views( $content ) {
$post_views = sprintf(
'<div class="stats_counter sd-content"><h3 class="sd-title">%1$s</h3><div class="sd-content">%2$s</div></div>',
@jeherve
jeherve / install.sh
Last active January 22, 2021 20:44
Installing my favorite apps on a new machine https://jeremy.hu/homebrew-cask-automate-mac-install/
#!/bin/sh
echo Install all AppStore Apps at first!
# If you are looking into a solution to automate AppStore installs,
# check mas https://github.com/argon/mas
# I installed XCode, Simplenote, Clocks, Stuffit Expander, Cloudapp, Forklift.
read -p "Press any key to continue... " -n1 -s
echo '\n'
@jeherve
jeherve / plugin.php
Created November 16, 2015 20:26
[Jetpack] Move Jetpack's sharing buttons from their default location to right under Woocommerce's product image.
<?php
/**
* Move Jetpack's sharing buttons from their default location to right under Woocommerce's product image
*
* @see http://jetpack.me/2013/06/10/moving-sharing-icons/
* @see http://businessbloomer.com/woocommerce-move-jetpack-social-sharing-single-product-page-tabs/ for an alternative placement
*/
function jeherve_move_jp_sharing_icons_woo() {
// Start by checking if Jetpack's sharing buttons are actually in use on the site
@jeherve
jeherve / plugin.php
Last active November 26, 2020 16:16
[Jetpack] A little plugin to strip down Jetpack until all what's left is the Markdown block
<?php
/**
* Plugin Name: Markdown from Jetpack
* Plugin URI: https://jetpack.com
* Description: Use only the Markdown block in Jetpack, nothing else. This must be installed in addition to the Jetpack plugin.
* Author: Automattic
* Version: 1.0.0
* Author URI: https://jetpack.com
* License: GPL2+
* Requires at least: 5.5