Skip to content

Instantly share code, notes, and snippets.

View swinggraphics's full-sized avatar

Greg Perham swinggraphics

  • Swing Graphics
  • Northampton, MA
View GitHub Profile
@swinggraphics
swinggraphics / allow-links-in-excerpts.php
Created June 7, 2018 01:03
WordPress strips out tags in `wp_trim_words()`, which is called by `get_the_excerpt()`; so we have to filter 'wp_trim_words', basically copying that function with one change: replace `wp_strip_all_tags()` with `strip_tags()`. We don't want other functions that run `wp_trim_words` to be modified, so we add our filter while `get_the_excerpt()` is …
@swinggraphics
swinggraphics / broadcast-replace-site_url.php
Created May 14, 2018 23:21
Replace site_url in posts syndicated by WP Broadcast
<?
/**
* Hook into Broadcast
* Modify links in the broadcasted post content
* "Replace Site URL" checkbox appears in child post meta box to show if this was applied
*/
add_action( 'threewp_broadcast_prepare_meta_box', 'my_custom_prepare_meta_box' );
function my_custom_prepare_meta_box( $action ) {
$meta_box_data = $action->meta_box_data; // Convenience.