WordPress.org

Ready to get started?Download WordPress

Forums

PHP Source changes (1 post)

  1. Unrated
    Member
    Posted 7 years ago #

    I installed WP few days ago and i wanted to add PHP highlight function so i started changing a bit of the source code.

    http://www.unrated.be/permalink/update-wp-source-modified/

    I added

    function highlight_with_pre ( $text )
    {
    return "<pre class="phppre">" . highlight_string( '<?php ' . $text . ' ?>', TRUE ) . "</pre>";
    }

    and

    $output = preg_replace("#[PHP](.*?)[/PHP]#ies", "highlight_with_pre('$1')", $output);

    in the file functions-formatting.php

    the preg_replace was in added on the bottom of the wptexturize function

    Now that all works but i get a wrong output and i dont get what is causing it? You can see the output in the link i provided. The highlight function outputs & and stuff like that but WP makes something else of it.

    Can you plz tell me whats causing this and how to fix it?
    Or maybe tell me where the final output of a post happens? So i can do the preg_replace then

    Greetz
    Unrated

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.