Skip to content

Instantly share code, notes, and snippets.

View NigelRodgers's full-sized avatar

Nigel Rodgers NigelRodgers

  • Harare, Zimbabwe
View GitHub Profile
@sybrew
sybrew / remove-woocommerce-message-part.php
Last active October 15, 2021 05:24
Removes "Continue Shopping" message from WooCommerce after item has been added to cart.
<?php
\add_filter( 'wc_add_to_cart_message', function( $string, $product_id = 0 ) {
$start = strpos( $string, '<a href=' ) ?: 0;
$end = strpos( $string, '</a>', $start ) ?: 0;
return substr( $string, $end ) ?: $string;
} );
@websupporter
websupporter / change-oembed-output.php
Last active February 1, 2022 15:36
Change the oEmbed output of WordPress
<?php
add_filter( 'oembed_response_data', 'fwe_oembed_response_data', 11, 4 );
function fwe_oembed_response_data( $data, $post, $width, $height ){
if ( ! is_object( $post ) )
return $data;
if( ! has_post_thumbnail( $post->ID ) )
return $data;
$thumbnail_id = get_post_thumbnail_id( $post->ID );
$image = wp_get_attachment_image_src( $thumbnail_id, 'full' );