Need help with Filter hook
-
Hello, I’m just starting to play with filter hooks and in this instance trying to insert some elements after the post text. The problem that I faced is that all text will render after the post content, but the two functions (get_template_part and similar_posts) that I’m calling would actually render before the post content. This is the code that I’m using in functions.php (you can see how it looks at balticgamers.net/1/):
function insertFootNote($content) { if(!is_feed() && !is_home()) { //Starting FaceBook button code get_template_part( 'template-part-FaceBook-button-bottom' ); //Starting related articles list $content.= "<div id='similar-articles'>"; $content.= "<strong>Related Posts:</strong>"; $content.= "<br /><br />"; similar_posts(); $content.= "</div>"; //Starting copyright text $content.= "<div id='terms-of-use'>"; $content.= "<a href='http://balticgamers.com/terms-of-use' title='Terms of use'>© copyright text »</a>"; $content.= "</div>"; } return $content; } add_filter ('the_content', 'insertFootNote');
Thank you!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Need help with Filter hook’ is closed to new replies.