Plugin Directory

Changeset 2032298


Ignore:
Timestamp:
02/16/2019 08:41:11 PM (7 years ago)
Author:
swack
Message:

Greentexting now also applied to posts and pages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • greentext/trunk/greentext.php

    r2032169 r2032298  
    55 * Plugin Name: Greentext
    66 * Plugin URI:  https://wordpress.org/plugins/greentext/
    7  * Description: Enables >greentexting in Wordpress comments. The plugin adds a span with the style color:green to comment lines that start with the ">" character. The span also has a class name of "greentext" in case you want to give it a different style in your CSS.
    8  * Version:     1.0
     7 * Description: Enables >greentexting in comments, posts, and pages. The greentext can be customized via CSS or left default green.
     8 * Version:     1.0.1
    99 * Author:      swack
    1010 * Author URI:  https://twitter.com/swack
     
    2828    foreach($lines as $line)
    2929    {
    30         $treated .= substr($line, 0, 4) == "&gt;" ? '<span style="color:green" class="greentext">' . $line . '</span>' : $line;
     30        $treated .= substr($line, 0, 1) == ">" ? '<span class="greentext" style="color:green;">' . $line . '</span>' : substr($line, 0, 4) == "&gt;" ? '<span class="greentext" style="color:green;">' . $line . '</span>' : $line;
     31        $treated .= PHP_EOL;
    3132    }
    3233   
     
    3435}
    3536
     37// Applies greentext to comments
    3638add_action('comment_text', 'greentext', 1);
     39
     40// Applies greentext to posts and pages
     41add_action('the_content', 'greentext', 1);
     42
    3743?>
Note: See TracChangeset for help on using the changeset viewer.