Support » Plugins » Adding a Filter with str_replace to functions.php

  • Hello!
    I am a NOOB when it comes to writing functions for the functions.php file. What I would like to do is to incorporate the “More to the Top” plugin into a theme via the functions.php file.

    Here is my code that is not working in my functions.php file:

    add_filter( 'the_content', 'moretothetop' );
    function moretothetop( $content ) {
    	global $post;
    	return str_replace( array( '#more-' . $post->ID . '"', '<span id="more-' . $post->ID . '"></span>' ), array( '"', '' ), $content);

    Can you help me figure this out?


  • The topic ‘Adding a Filter with str_replace to functions.php’ is closed to new replies.