-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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