WordPress.org

Ready to get started?Download WordPress

Forums

WP-Syntax
Patch to set default language (1 post)

  1. kchodorow
    Member
    Posted 2 years ago #

    Sometimes I like to use <pre line="1"> or <pre highlight="7">, but then Geshi spits out tons of PHP warnings because no "lang" attribute is defined.

    This patch for wp-syntax.php fixes the warnings by setting the language to "text" if a "lang" isn't given:

    @@ -110,6 +110,10 @@ function wp_syntax_highlight($match)
         $match = $wp_syntax_matches[$i];
    
         $language = strtolower(trim($match[1]));
    +    if (empty($language)) {
    +      $language = "text";
    +    }
    +
         $line = trim($match[2]);
         $escaped = trim($match[3]);

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags