WordPress.org

Ready to get started?Download WordPress

Forums

Newsletter
Adding a link to the "[...]" at the end of the excerpt in email templates (2 posts)

  1. tcolling
    Member
    Posted 1 year ago #

    Hi - I'm using WordPress 3.4.2 and Newsletter 3.0.9 at http://www.TrustworthyCare.com. I've created an email template that works pretty well for our needs because it works well for both full-size email client screens, like desktops and laptops, and also on mobile devices' email clients, because it uses percentages for table widths instead of fixed widths. That was based on a suggestion from the plugin's creator Stefano Lissa. Thanks, Stefano!

    For anyone interested, I've pasted the template code into this message, at the end of the message.

    There's one more thing I'd like to change here before I begin using the template in production: when the email is created it includes excerpts from the posts that are formatted with "[...]" at the end of the excerpt. I would like the ellipsis (the three periods, "...") to be hyperlinked to the article for that excerpt. However, the ellipsis is already being generated and appended to the end of the excerpt by some other code, somewhere, and I don't know where or how to add the link.

    Can anyone suggest a solution to add the link to that ellipsis? Right now, I'm working around this by making the entire excerpt be linked to the article, but that seems clumsy to me.

    Thanks!

    - Tim

    ==========================
    Here's the template code:
    ==========================
    <?php
    global $newsletter; // Newsletter object
    global $post; // Current post managed by WordPress

    /*
    * Some variabled are prepared by Newsletter Plus and are available inside the theme,
    * for example the theme options used to build the email body as configured by blog
    * owner.
    *
    * $theme_options - is an associative array with theme options: every option starts
    * with "theme_" as required. See the theme-options.php file for details.
    * Inside that array there are the autmated email options as well, if needed.
    * A special value can be present in theme_options and is the "last_run" which indicates
    * when th automated email has been composed last time. Is should be used to find if
    * there are now posts or not.
    *
    * $is_test - if true it means we are composing an email for test purpose.
    */

    // This array will be passed to WordPress to extract the posts
    $filters = array();

    // Maximum number of post to retrieve
    $filters['showposts'] = (int)$theme_options['theme_max_posts'];
    if ($filters['showposts'] == 0) $filters['showposts'] = 10;

    // Include only posts from specified categories. Do not filter per category is no
    // one category has been selected.
    if (is_array($theme_options['theme_categories'])) {
    $filters['cat'] = implode(',', $theme_options['theme_categories']);
    }

    // Retrieve the posts asking them to WordPress
    $posts = get_posts($filters);

    // Styles
    $color = $theme_options['theme_color'];
    if (empty($color)) $color = '#777';

    $font = $theme_options['theme_font'];
    $font_size = $theme_options['theme_font_size'];

    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title></title>
    <style>
    * {
    font-family: <?php echo $font; ?>;
    font-size: <?php echo $font_size; ?>;
    }
    </style>
    </head>
    <body>

    <table width="90%">

    <tr align="center"><td>

    <p>

    <img src="http://www.trustworthycare.com/sitectrl/wp-content/themes/t16/custom/images/servants_heart_care_solutions_logo_266x117.png" alt="Caring, Consistent, Dependable Caregivers in San Diego County" title="Caring, Consistent, Dependable Caregivers in San Diego County">

    </p>
    <b><i>Where The Needs Of Others Come First!</b></i>

    <h1>Latest News For Seniors And Their Families</h1>
    </tr></td>

    <tr align="left"><td>
    Every week we publish articles for you on our website about the most relevant news about the art, science, business and politics of aging in the United States and the rest of the world. This edition of our newsletter summarizes the articles that we've published since the date of our last newsletter, and we hope you enjoy it!

    </tr></td>

    </table>
    <table width="90%">

    <?php
    foreach ($posts as $post) {
    setup_postdata($post);
    $image = nt_post_image(get_the_ID());
    ?>

    <tr align="left">
    <td>

    <p style="font-family:arial,sans-serif;color:#456;font-size:20px;line-height:22px;margin:0;padding:0">

    " target="_blank"><img src="<?php echo $image; ?>" align="right" alt="" border="0">
    " style="color:#456;text-decoration:none;align:center" target="_blank">

    <?php the_title(); ?>
    <!--</p>
    <p style="font-family:arial,sans-serif;line-height:1.5em;margin:15px 0;padding:0">-->
    <?php the_excerpt(); ?>
    </p>

    </td>
    </tr>

    <?php
    }
    ?>

    </table>
    <table width="90%">
    <tr align="center"><td>

    <p align="center">

    <img src="http://www.trustworthycare.com/sitectrl/wp-content/themes/t16/custom/images/servants_heart_care_solutions_logo_266x117.png" alt="Caring, Consistent, Dependable Caregivers in San Diego County" title="Caring, Consistent, Dependable Caregivers in San Diego County">

    <b><i>Where The Needs Of Others Come First!</b></i>
    </p>

    <h2>
    <p align="center">
    Caring, Consistent, Dependable
    Companions and Caregivers in North San Diego County</h2></p>
    <h3><p align="center">Call us toll-free at (800) 777-4750 today
    or visit us at http://www.TrustworthyCare.com.</p>
    </h3>

    <p align="center">
    Your older loved ones can continue living in their own home with carefully screened caregivers provided by A Servant's Heart, where the needs of others come first. All types of care are available, from simple companionship to complete personal and supportive care services.</p>

    <p align="center">
    A Servant's Heart Care Solutions, Inc.
    250 S. Pacific Street, Suite 104
    San Marcos, California 92078
    t. 800-777-4750
    f. 760-874-2870
    http://www.TrustworthyCare.com</p>

    <p align="center"><?php echo $theme_options['theme_pre_message']; ?></p>
    </td></tr></table>

    </body>
    </html>

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

  2. tcolling
    Member
    Posted 1 year ago #

    (please ignore this, I didn't mean to post a second time)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic