Skip to content

Instantly share code, notes, and snippets.

@swissspidy
swissspidy / web-stories-auto-analytics.php
Last active November 23, 2023 09:43
Mini-plugin to add an additional Google Analytics tracking code to web stories
<?php
/**
* Plugin Name: Web Stories Additional GA Tracking
* Description: Mini-plugin to add an additional Google Analytics tracking code to web stories
* Plugin URI: https://wp.stories.google/
* Author: Pascal Birchler, Google
* Author URI: https://opensource.google.com/
* Version: 0.0.1
* License: Apache License 2.0
* License URI: https://www.apache.org/licenses/LICENSE-2.0
@feastdesignco
feastdesignco / modern-homepage-blocks
Last active October 7, 2022 22:37
modern-homepage-blocks
<!-- wp:paragraph -->
<p>First, update your post title to match your site tagline. Then, edit this paragraph to match your homepage's meta description tag, which should tell potential readers what your site specializes in. Keep it to no more than 2-3 sentences.</p>
<!-- /wp:paragraph -->
<!-- wp:heading -->
<h2>Trending Recipes</h2>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>Edit this paragraph to tell your readers why these recipes are so popular right now</p>
/**
* A bookmarklet for viewing the largest contentful paint in a page.
* Will show each LCP after the bookmarklet is clicked.
*
* To install:
* 1. Copy the code starting from the line beginning `javascript:`
* 2. Add a new bookmark in Chrome, and paste the code in as the URL.
**/
javascript:(function(){
try {
@vovafeldman
vovafeldman / functions.php
Last active January 25, 2022 04:23
Freemius - WP Markdown Editor, Exporting
<?php
/**
* When exporting using WP default export tool, use the
* markdown version when exist.
*
* @author Vova Feldman
*
* @param string $content
*
* @return string
@aaemnnosttv
aaemnnosttv / as3cf-upload-missing-media-library-items-to-s3.php
Last active December 2, 2023 00:40
AS3CF - Upload all missing media library items to S3
<?php
/**
* For use with Amazon S3 and CloudFront by Delicious Brains
*
* Upload this file to your installation and trigger it with WP-CLI:
* wp eval-file as3cf-upload-missing-media-library-items-to-s3.php
*/
global $as3cf;
@thomasgriffin
thomasgriffin / gist:525dc80a20cb69c7e8bf
Created December 11, 2014 20:00
Turn off tracking in OptinMonster.
<?php
add_filter( 'optin_monster_data', 'tgm_om_turn_off_tracking' );
function tgm_om_turn_off_tracking( $data ) {
$data['tracked'] = true;
return $data;
}
@aaemnnosttv
aaemnnosttv / soft-disable-plugins.php
Created May 20, 2014 18:01
Soft Disable All WP Plugins
<?php
/**
* Plugin Name: Soft disable all WP plugins
* Author: Evan Mattson (@aaemnnosttv)
* Description: Allows all plugins to be softly disabled and re-enabled using a single constant.
* Version: 1.0
*
* Usage: Install this under mu-plugins/, and define('SOFT_DISABLE_PLUGINS', true) to soft disable all plugins.
* Delete/comment-out the constant definition or set to false to restore all plugins to their previous active states.
*
@Pross
Pross / functions.php
Created April 4, 2014 22:46
Remove thumbnail from single posts
<?php
function remove_post_thumbnail($metadata, $object_id, $meta_key, $single){
if( isset($meta_key) && '_thumbnail_id' === $meta_key && is_single() )
return false;
else
return $metadata;
}
add_filter('get_post_metadata', 'remove_post_thumbnail', true, 4);
@burnified
burnified / Enqueue Typekit via Wordpress
Created March 28, 2014 19:25
Enqueue Typekit via Wordpress
/*** TypeKit Fonts ***/
function theme_typekit() {
wp_enqueue_script( 'theme_typekit', '//use.typekit.net/hoo8stk.js');
}
add_action( 'wp_enqueue_scripts', 'theme_typekit' );
function theme_typekit_inline() {
if ( wp_script_is( 'theme_typekit', 'done' ) ) { ?>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
@srikat
srikat / functions.php
Last active February 8, 2022 20:06
Magnifying glass icon font using Dashicons for Search button in Genesis. http://sridharkatakam.com/add-magnifying-glass-icon-font-using-dashicons-search-button-genesis/
//* Enqueue Dashicons
add_action( 'wp_enqueue_scripts', 'enqueue_dashicons' );
function enqueue_dashicons() {
wp_enqueue_style( 'dashicons' );
}
//* Customize search form input button text
add_filter( 'genesis_search_button_text', 'sk_search_button_text' );