WordPress: Newsletter-Templates anpassen

WordPress-Newsletter-Plugin

hier wohnen die Themes: /www/wp-content/plugins/newsletter/emails/themes

Das IT Freelancer Magazin nutzt, weil es am hübschesten aussieht das vimeo-like.

Grundlagen

theme.php ist die Hauptdatei

theme-options.php – aus dieser .php wird die Webseite zum Anlegen eines konkreten neuen Newsletters erstellt, aufrufbar über /wp-admin/admin.php?page=newsletter_emails_new

die Werte die der User dort eingegeben hat, werden in der theme.php verwendet, z.B. $theme_options[‚theme_pre_message‘];

… und in der Tabelle wp_options gespeichert. Z.B. für das vimeo-Theme in newsletter_emails_theme_vimeo-like, was dann beim IT Freelancer Magazin konkret so aussieht:

a:14:{s:15:"theme_max_posts";s:1:"3";s:16:"theme_categories";a:1:{i:0;s:1:"4";}s:17:"theme_pre_message";s:176:"This email has been sent to {email} because subscribed and confirmed on IT Freelancer Magazin. <a href="{profile_url}">Click here to modify you subscription or unsubscribe</a>.";s:20:"theme_footer_message";s:29:"<a href="test.de">test.de</a>";s:15:"theme_read_more";s:9:"Read More";s:14:"theme_facebook";s:0:"";s:13:"theme_twitter";s:0:"";s:15:"theme_pinterest";s:0:"";s:16:"theme_googleplus";s:0:"";s:14:"theme_linkedin";s:0:"";s:12:"theme_tumblr";s:0:"";s:13:"theme_youtube";s:0:"";s:16:"theme_soundcloud";s:0:"";s:15:"theme_instagram";s:0:"";}

In den Textboxen auf dieser Seite kann auch html-Code eingegeben werden – wer also beispielweise seine Sponsorenlogos unter dem Newsletter einbinden möchte, kann den entsprechenden html-Code in die Footer message-Box eintragen.

Wer seine Änderungen am Theme gegen Überschreiben bei Plugin-Updates schützen möchte: https://www.thenewsletterplugin.com/documentation/newsletter-themes

Use custom C#-libraries in Robot Framework

Read Install Robot Framework with IronPython on Windows and Use .NET libraries in Robot Framework first.
1. Save the Robot Framework file as ExampleTestCase.txt in C:\Program Files (x86)\robotframework-2.9\src\bin:

*** Settings ***
Library     FileManager
*** Test Cases ***
My Test
    Create File    fantastic.txt

2. Save the „middle-tier“ Python script as FileManager.py in C:\Program Files (x86)\robotframework-2.9\src\bin:

import clr
clr.AddReferenceToFileAndPath("C:/Program Files (x86)/robotframework-2.9/src/bin/FileCreator.dll")
import FileCreator
class FileManager:
    def create_file(self, fileName):
        FileCreator().CreateFile(fileName)

Note, that in Python an object is created with brackets: FileCreator()
Note, that Robot Framework automatically matches the keyword „Create File“ in ExampleTestCase.txt with „create_file“ in FileCreator.py
3. Save your custom C# file as FileCreator.cs in C:\Program Files (x86)\robotframework-2.9\src\bin:

using System;
public class FileCreator
{
    public void CreateFile(String fileName)
    {
        System.IO.File.Create(fileName);
    }
}

4. Compile FileCreator.cs with csc in Command Prompt:

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" /t:library /out:FileCreator.dll "C:\Program Files (x86)\robotframework-2.9\src\bin\FileCreator.cs"

5. Run the test in Command Prompt with:

ipybot ExampleTestCase.txt