• I have made a modification to the ‘wp-useronline’ plugin which simply adds a line at the top of my page. The change I have made is to a file called ‘template-tags.php’ and is as shown in the image below.

    I would like to make this modification in ‘functions.php’ instead so that future updates do not impact it. Can someone please explain how I might accomplish this?

    Thanks in advance…

    image

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Something like this:

    add_filter('useronline_page', 'my_callback');
    function my_callback( $output ) {
       // add desired text content to $output
       return $output;
    }

    Naturally the content from $text would not be in $output. You need to figure out how to place it where it’s needed within $output. str_replace() or preg_replace() should do it.

    • This reply was modified 9 years, 2 months ago by bcworkz. Reason: typo
Viewing 1 replies (of 1 total)

The topic ‘Move customization from plugin file to functions.php’ is closed to new replies.