Ready to get started?Download WordPress


Adding a Filter with str_replace to functions.php (1 post)

  1. llamaman
    Posted 5 years ago #

    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?


Topic Closed

This topic has been closed to new replies.

About this Topic