theme.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <?php
  2. /*
  3. * Name: Default
  4. * Type: standard
  5. * Some variables are already defined:
  6. *
  7. * - $theme_options An array with all theme options
  8. * - $theme_url Is the absolute URL to the theme folder used to reference images
  9. * - $theme_subject Will be the email subject if set by this theme
  10. *
  11. */
  12. global $newsletter, $post;
  13. defined('ABSPATH') || exit;
  14. if (empty($theme_options['theme_color']))
  15. $color = '#555555';
  16. else
  17. $color = $theme_options['theme_color'];
  18. if (isset($theme_options['theme_posts'])) {
  19. $filters = array();
  20. if (empty($theme_options['theme_max_posts']))
  21. $filters['posts_per_page'] = 10;
  22. else
  23. $filters['posts_per_page'] = (int) $theme_options['theme_max_posts'];
  24. if (!empty($theme_options['theme_categories'])) {
  25. $filters['category__in'] = $theme_options['theme_categories'];
  26. }
  27. if (!empty($theme_options['theme_tags'])) {
  28. $filters['tag'] = $theme_options['theme_tags'];
  29. }
  30. if (!empty($theme_options['theme_post_types'])) {
  31. $filters['post_type'] = $theme_options['theme_post_types'];
  32. }
  33. if (!empty($theme_options['language'])) {
  34. $filters['suppress_filters'] = false;
  35. do_action('wpml_switch_language', $theme_options['language']);
  36. }
  37. $posts = get_posts($filters);
  38. }
  39. ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  40. <html>
  41. <head>
  42. <!-- Not all email client take care of styles inserted here -->
  43. <style type="text/css" media="all">
  44. a {
  45. text-decoration: none;
  46. color: <?php echo $color; ?>;
  47. }
  48. </style>
  49. </head>
  50. <body style="margin: 0!important; padding: 0!important">
  51. <div style="background-color: #f4f4f4; font-family: Helvetica Neue, Helvetica, Arial, sans-serif; font-size: 14px; color: #666; margin: 0 auto; padding: 0;">
  52. <br>
  53. <table align="center" bgcolor="#ffffff" width="100%" style="max-width: 600px; width: 100%; border-collapse: collapse; background-color: #000" cellpadding="0" cellspacing="0" border="0">
  54. <tr>
  55. <td valign="top" bgcolor="#ffffff" width="100%" style="font-family: Helvetica Neue, Helvetica, Arial, sans-serif; font-size: 14px; color: #666;">
  56. <div style="text-align: left; background-color: #fff;">
  57. <div style="text-align: center">
  58. <?php
  59. //HEADER
  60. // if (!empty($theme_options['theme_banner'])) {
  61. // echo $theme_options['theme_banner'];
  62. if (!empty($theme_options['theme_header_logo']['url'])) {
  63. ?>
  64. <img style="max-width: 500px" alt="<?php echo esc_attr($theme_options['main_header_title']) ?>" src="<?php echo esc_attr($theme_options['theme_header_logo']['url']) ?>">
  65. <?php } elseif (!empty($theme_options['main_header_logo']['url'])) { ?>
  66. <img style="max-width: 500px" alt="<?php echo esc_attr($theme_options['main_header_title']) ?>" src="<?php echo esc_attr($theme_options['main_header_logo']['url']) ?>">
  67. <?php } elseif (!empty($theme_options['main_header_title'])) { ?>
  68. <div style="padding: 30px 0; color: #000; font-size: 28px; background-color: #EFEFEF; border-bottom: 1px solid #ddd; text-align: center;">
  69. <?php echo $theme_options['main_header_title'] ?>
  70. </div>
  71. <?php if (!empty($theme_options['main_header_sub'])) { ?>
  72. <div style="padding: 10px 0; color: #000; font-size: 16px; text-align: center;">
  73. <?php echo $theme_options['main_header_sub'] ?>
  74. </div>
  75. <?php } ?>
  76. <?php } else { ?>
  77. <div style="padding: 30px 20px; color: #000; font-size: 28px; background-color: #EFEFEF; border-bottom: 1px solid #ddd; text-align: center;">
  78. <?php echo get_option('blogname'); ?>
  79. </div>
  80. <?php if (!empty($theme_options['main_header_sub'])) { ?>
  81. <div style="padding: 10px 0; color: #000; font-size: 16px; text-align: center;">
  82. <?php echo $theme_options['main_header_sub'] ?>
  83. </div>
  84. <?php } ?>
  85. <?php } ?>
  86. </div>
  87. <div style="padding: 10px 20px 20px 20px; background-color: #fff; line-height: 18px">
  88. <p style="text-align: center; font-size: small;"><a target="_blank" href="{email_url}">View this email online</a></p>
  89. <p>Here you can start to write your message. Be polite with your readers! Don't forget the subject of this message.</p>
  90. <?php if (!empty($posts)) { ?>
  91. <table cellpadding="5">
  92. <?php foreach ($posts as $post) {
  93. setup_postdata($post); ?>
  94. <tr>
  95. <?php if (isset($theme_options['theme_thumbnails'])) { ?>
  96. <td valign="top"><a target="_blank" href="<?php echo get_permalink($post); ?>"><img width="75" style="width: 75px; min-width: 75px" src="<?php echo newsletter_get_post_image($post->ID); ?>" alt="image"></a></td>
  97. <?php } ?>
  98. <td valign="top">
  99. <a target="_blank" href="<?php echo get_permalink(); ?>" style="font-size: 20px; line-height: 26px"><?php the_title(); ?></a>
  100. <?php if (isset($theme_options['theme_excerpts'])) newsletter_the_excerpt($post); ?>
  101. </td>
  102. </tr>
  103. <?php } ?>
  104. </table>
  105. <?php } ?>
  106. <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/footer.php'; ?>
  107. </div>
  108. </div>
  109. </td>
  110. </tr>
  111. </table>
  112. <br><br>
  113. </div>
  114. </body>
  115. </html>