Home Forums Newsletter Plugin Support How to sort posts by categories in a newsletter ?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #23268
    Seppia
    Participant

    Hello

    I’m trying to build a newsletter template that would automatically set the posts according to their category on a certain layout.
    For example my newsletter would look like :

    CATEGORY 1 TITLE
    Post1FromCategory1
    Post2FromCategory1
    Post3FromCategory1

    CATEGORY 2 TITLE
    Post1FromCategory2
    Post1FromCategory2
    Post1FromCategory2

    So far, I’ve duplicated an existing free template and started editing the code, according to this page.

    The code that generates the table containing the posts is :

    <?php if (!empty($posts)) { ?>
                                <table cellpadding="5">
                                    <?php foreach ($posts as $post) { setup_postdata($post); ?>
                                        <tr>
                                            <?php if (isset($theme_options['theme_thumbnails'])) { ?>
                                                                                    
                                             <td valign="top"><a target="_blank"  href="<?php echo get_permalink($post); ?>"><img width="360px" src="<?php echo newsletter_get_post_image($post->ID, 'medium'); ?>" alt="image"></a></td>
                                            <?php } ?>
                                            <td valign="top">
                                                <a target="_blank"  href="<?php echo get_permalink(); ?>" style="font-size: 20px; line-height: 26px; text-transform: uppercase;"><?php the_title(); ?></a>
                                                <?php if (isset($theme_options['theme_excerpts'])) the_excerpt($post); ?>
                                                
                                                                                           
                                            </td>
                                            
                                            
                                            
                                            ?>
                                           
                                        </tr>
                                    <?php } ?>
                                </table>
                                <?php } ?>

    I guess I should duplicate the table, customize it for each category, and for each instance filter only the posts from a certain category to go in a certain table, but I don’t know how to do this last part.

    If anyone wants to give a hand, I’d be grateful!

    #30680
    Niall O’Donnell
    Participant

    Did you have any luck with this?

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.