WordPress.org

Ready to get started?Download WordPress

Forums

Subscribe2
Ugly excerpt (3 posts)

  1. flemmingbjerke
    Member
    Posted 2 years ago #

    The excepts send out are quite ugly because there are arbitrary end-of-lines (\n) in the text. I have tried to remove them with:

    $message_post .= preg_replace("[\n]"," ",$excerpt) . "\r\n\r\n";

    at line 3851 in subscribe2.php. But, it does not work.

    Any suggestions?

    http://wordpress.org/extend/plugins/subscribe2/

  2. mattyrob
    Member
    Plugin Contributor

    Posted 2 years ago #

    @flemmingbjerke,

    It's not working as you are stripping them out before they are added. They are added in the mail() function in the subscribe2 code on line 387:
    $message = wordwrap(strip_tags($message), 80, "\n");

    Try replacing this with:
    $message = strip_tags($message);

  3. flemmingbjerke
    Member
    Posted 2 years ago #

    Thank you very much, Matty. It helped.

    But, now the width in of each line is app. 50 character. Has this something to do with how wordpress produces excerpts to subscribe2? This 50 line limit should be removed before the wordwrap to 80 chars is used. Else, the excerpt becomes really ugly.

    I have made some changes to make the excerpts nicer. This is of course a matter of taste ... except that the headline is not emphasised, which makes it more difficult to spot the headline.

    I am using plaintext notifications, therefore, to underline the headline, I changed line 3795 to:
    $message_post .= $post_title . "\n=====================================================";
    And the same for the following line. Similar may be done for html.

    In order to retain double new lines, I have changed '|\s+|' in line 703, 704, 3868 and 3869 to ' +'. E.g. line 703:
    $excerpt = preg_replace(' +', ' ', $excerpt);
    Particularly, the original lines 3868 and 3869 make it impossible to tweak the format of the excerpts in a nice way because all double new lines is removed. Also when inserted in the settings new post text area! I think another solution to this should be figured out.

    Thinking about it, I think the best would be to split up the excerpt so that {POST} gives the excerpt text only. (And stop using {POSTTIME}). Then, the user must find out how to place and format {TITLE},{TIME},{PERMALINK}, etc. That would give optimal opportunities for formatting the excerpts in the settings' new post text area. (If line 3868 and 3869 is changed.)

    Subscribe2 is great :-)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags