The WordPress plug-in Conditions for Texts allows bloggers to use IF- & IF-ELSE conditions in their posts and pages. With this amazing plug-in, specific content and texts can be published in accordance with certain conditions, for example date or time.
» Hier geht es zur deutschen Version dieser Seite
How to use the WordPress Plug-in
An article is intended to introduce a specific product. The text of this article should be automatically published different text at christmas than in the rest of the year.
<h1>Gift idea for men [IF $month>10] for Christmas[ELSE] for Birthday[/IF]</h1> [IF $month>=1 AND $month<=10] <p>This beer backpack is the ideal birthday gift for all men </p> [ELSE] <p>This beer backpack is the ideal Christmas gift for all men </p> [/IF]
As you can see in this example, bloggers can tailor their articles to specific time periods or dates, such as holidays, and thus handle seasonal events automatically.
Versions
The WordPress plug-in is available in two different versions – the Standard and Extented version. The standard version is free of charge and has a slightly lower functionality than the extended version, which is very cheap to buy for 2,99 €.
Here you can see the difference between the two versions of the plug-in:
Funktion | Beispiele | Standard | Extended |
---|---|---|---|
Preis | Kostenlos DOWNLOAD | Nur 2,99 € DOWNLOAD |
|
IF-Verzweigung | [IF $var==1] ... [/IF] | ✓ | ✓ |
IF-ELSE-Verzweigung | [IF $var==1] ... [ELSE] ... [/IF] | ✓ | ✓ |
Vergleichs-Operatoren ( == , >= , <= , != , < , > ) | [IF $month>10] ... [/IF] [IF $month!=12] ... [/IF] | ✓ | ✓ |
Logische Operatoren ( AND , OR ) | [IF $day>=1 AND $day<=10] ... [/IF] [IF $month==7 OR $month==7] ... [/IF] | ✗ | ✓ |
Enthält-Operator ( contains ) | [IF $userAgent contains chrome] Chrome Browser [/IF] | ✓ | ✓ |
Variablen-Set "Standard": $day, $month, $year, $hour, $minute, $date | [IF $hour>12] ... [/IF] [IF $year<2018] ... [/IF] [IF $date==2018-12-24] ... [/IF] | ✓ | ✓ |
Variablen-Set "Extended": $remoteIP, $userAgent, $httpReferer, $browserLanguage, $permaLink, $dayOfWeek, $dayOfYear, $leapYear, $amORpm, $pageId, $postId, $categoryName, $authorId | [IF $remoteIP>191.168.0.1] ... [/IF] [IF $browserLanguage==de] ... [/IF] [IF $leapYear==true] Schaltjahr [/IF] [IF $dayOfWeek==0] Sonntag [/IF] | ✗ | ✓ |
Existenzvergleich | [IF something] true [/IF] (irgendwas kann z. B. eine Shortcode-Ausgabe sein) | ✓ | ✓ |
Available variables for the conditions
The following variables are available in the standard and extended version:
- $day – Day (1…31)
- $month – Month (1..12)
- $year – Year (2018)
- $hour – Hour (1..24)
- $minute – Minute (1..59)
- $date – Date (2018-12-24)
In the Extended version the following additional variables are available:
- $remoteIP – IP-Address of the visitor (123.123.123.123)
- $userAgent – User-Agent of the visitor (String)
- $httpReferer – Referer-URL of the visitor (String)
- $browserLanguage – Language of the Browser (e.g. de,en,…)
- $permaLink – Permanent url of the current page or post (https://…/category/title)
- $dayOfWeek – Day in week (0=Sonntag, 6=Samstag)
- $dayOfYear – Day of the year (1…365)
- $leapYear – Leap year (true, false)
- $amORpm – Morning or Afternoon (am, pm)
- $pageId – ID of the current page (int)
- $postId – ID of the current post (int)
- $categoryName – Name of the category (String)
- $authorId – ID of the author (int)
Scope of the plug-in
The plug-in can be used in the following content areas of your blog:
- Content text of a page or post (the_content)
- Title of a page or post (the_title, pre_get_document_title)
- Meta-Title and Meta-Description (wpseo_title, wpseo_metadesc)
- Text in the header <head></head> (wp_head)
- Text in the footer (wp_footer)
- Text in widgets (widget_text)
Third party plug-in Support
Currently the plug-in supports the following third party plug-ins:
- Shortcode-Plugins like Shortcoder (Usefull: Check if parameters in the shortcode content are set!)
- Tablepress