Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Add HTML or Shortcode before or after the_content() - WordPress mu-plugin
<?php
// This particular example adds Hustle Social Sharing shortcode after content without editing template files on single posts/pages only.
function jmorris_before_after($content) {
$beforecontent = '';
if ( is_single() ) {
$aftercontent = '[wd_hustle_ss id="jmorris-online"]';
} else {
$aftercontent = '';
}
$fullcontent = $beforecontent . $content . $aftercontent;
return $fullcontent;
}
add_filter('the_content', 'jmorris_before_after');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment