Home Forums Newsletter Plugin Support Let the user choose the order of the articles in the theme options panel

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #10036


    I am creating a new Newsletter theme and I would like to let the user decide in which order the articles should be shown in the Newsletter. My Newsletter is divided by categories, some categories have 2 articles and other more.

    To do so I decided to create a select menu for each item of the Newsletter.
    I added a new function in controls.php to the NewsletterControls class :

        /** Creates a select menu with all posts from a specified category.
        function category_posts($name = 'category_posts', $categoryid) {
            $list = array();
            $category_posts = get_posts(array('category' => $categoryid));
            foreach ($category_posts as &$category_post) {
                $list[$category_post->ID] = $category_post->post_title;
            $this->select($name, $list);

    Then in my theme-options.php I add :

    Article 1: <?php $controls->category_posts('theme_category_post1', 4); ?>

    I can also add several select menus for different categories :

    Article 1 for category 4: <?php $controls->category_posts('theme_category_post1', 4); ?>
    Article 1 for category 5: <?php $controls->category_posts('theme_category_post2', 5); ?>
    Article 2 for category 5: <?php $controls->category_posts('theme_category_post3', 5); ?>

    This solution actually work but I don’t know if it is the best way to do so and I would like to have your suggestion.

    Also, is there a way to implement this solution without losing the code when I will update the plugin?

    Thanks a lot!


    I’m interested about it.

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