Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pixelbart
Created August 1, 2020 16: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 pixelbart/0aa2e13d0d83153b6759506bc6d4b29b to your computer and use it in GitHub Desktop.
Save pixelbart/0aa2e13d0d83153b6759506bc6d4b29b to your computer and use it in GitHub Desktop.
Places the Helpful shortcode at the end. (No guarantee that it will work)
<?php // functions.php
/**
* Show Helpful after the content.
*
* @global $post
*
* @param string $content
*
* @return string
*/
function helpful_after_content_high( $content ) {
global $post;
if ( ! is_archive() && is_singular() && 'post' === get_post_type( $post ) ) {
$content .= do_shortcode( '[helpful]' );
}
return $content;
}
/**
* Fires the function. PHP_INT_MAX tries to load Helpful always at the end.
*/
add_filter( 'the_content', 'helpful_after_content_high', PHP_INT_MAX );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment