Skip to content

Instantly share code, notes, and snippets.

@vaakash
Created January 23, 2022 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vaakash/26b4962ac011e70a531981d2819ce0a2 to your computer and use it in GitHub Desktop.
Save vaakash/26b4962ac011e70a531981d2819ce0a2 to your computer and use it in GitHub Desktop.
Adding share buttons to Super RSS Reading
<?php
// This code adds "Share buttons" to the feed items displayed using Super RSS Reader WordPress plugin. The RSS feed items are shared using AddToAny and Flipboard services.
// It uses Super RSS Reader's filter https://www.aakashweb.com/docs/super-rss-reader/actions-filters/#srr_mod_item_html to modify the output
add_filter( 'srr_mod_item_html', 'srr_share_buttons', 10, 3 );
function srr_share_buttons( $html, $feed_url, $feed_item ){
$item_url = $feed_item->get_permalink();
$share_link = 'https://www.addtoany.com/share?url=' . $item_url;
$share_html = '<a href="' . esc_attr( $share_link ) . '" target="_blank" title="Share this article"><img src="https://cdn1.iconfinder.com/data/icons/feather-2/24/share-48.png" width="16px"/> Share</a>';
$save_link = 'https://share.flipboard.com/bookmarklet/popout?v=2&url=' . $item_url;
$save_html = '<a href="' . esc_attr( $save_link ) . '" target="_blank" title="Save to Flipboard"><img src="https://cdn2.iconfinder.com/data/icons/ios-7-icons/50/plus-48.png" width="16px"/> Save</a>';
$html[ 'after' ] = $html[ 'after' ] . '<p>' . $share_html . '&nbsp;' . $save_html . '</p>';
return $html;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment