Skip to content

Instantly share code, notes, and snippets.

🚀
👨‍🏭

Jeremy Herve jeherve

🚀
👨‍🏭
View GitHub Profile
@jeherve
jeherve / install.sh
Last active Jul 14, 2020
Installing my favorite apps on a new machine https://jeremy.hu/homebrew-cask-automate-mac-install/
View install.sh
#!/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'
View direct-podcast.php
<?php
/**
* Display a Podcast player anywhere.
* Pulled from extensions/blocks/podcast-player/podcast-player.php
* @see https://github.com/Automattic/jetpack/blob/b88b1edbdce4d8576ce9be02a9093702ae112fed/extensions/blocks/podcast-player/podcast-player.php
* @see https://wordpress.org/support/topic/embedding-the-podcast-player-with-code/
*/
function jeherve_display_podcast() {
// bail early if Jetpack isn't installed.
if ( ! class_exists( 'Jetpack' ) ) {
@jeherve
jeherve / jetpack-feature-list-20200309.md
Last active May 13, 2020
[Jetpack] List of features as of March 9, 2020
View jetpack-feature-list-20200309.md

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 Jan 29, 2020
How To: Enable Debugging in WordPress
View debug-wordpress.md

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 Jul 3, 2019
[Jetpack] Deactivate Twitter Cards and / or Open Graph Meta tags.
View plugin.php
<?php
/*
* Plugin Name: Disable Jetpack Open Graph tags and Twitter Cards
* Plugin URI: http://wordpress.org/extend/plugins/jetpack/
* Description: Disables Jetpack Open Graph tags
* Author: Jeremy Herve
* Version: 1.0
* Author URI: http://jeremyherve.com
* License: GPL2+
*/
@jeherve
jeherve / plugin.php
Last active May 24, 2019
Remove state field from woocommerce checkout form.
View plugin.php
<?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'] );
View managing-jetpack-blocks.md

You could use the jetpack_set_available_extensions filter (reference) to avoid registering some of Jetpack's blocks in the editor. When you do so, they won't appear in the block editor.

That said, it won't change the size of the CSS file used to style those blocks in the editor; that file concatenates CSS for all blocks, regardless of what's actually available in the editor. It should not be too much of an issue though:

  1. That file is minified and rather small (63.8 KB right now - #).
  2. The file is only loaded in the editor. It is not loaded on the frontend. On your site, we only load CSS for the blocks that are on the page, and need CSS, and in those cases we use separate CSS files like the ones you can find in this directory.

I hope this clarifies things a bit.

@jeherve
jeherve / debug-wordpress.md
Created Sep 11, 2018
A test Gist, with 2 files
View debug-wordpress.md

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 / jp_restrict_rp.php
Last active Feb 10, 2018 — forked from richardmtl/jp_restrict_rp.php
Restrict Jetpack's Related Posts to a specific time-frame
View jp_restrict_rp.php
function jetpackme_related_posts_date_restricted( $date_range, $post_id ) {
// We can change this based on $post_id too but let's just filter everything
$date_range = array(
'from' => strtotime( '1 January 2013' ),
'to' => time(),
);
return $date_range;
}
add_filter( 'jetpack_relatedposts_filter_date_range', 'jetpackme_related_posts_date_restricted', 10, 2 );
@jeherve
jeherve / plugin.php
Created Nov 16, 2015
[Jetpack] Move Jetpack's sharing buttons from their default location to right under Woocommerce's product image.
View plugin.php
<?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
You can’t perform that action at this time.