Bepaal zelf wanneer een tekst in een artikel wordt weergegeven. Handig om in een artikel een korte tekstwijziging te plannen op basis van de datum. De plugin werkt met drie HTML-style tags. ‘Before’ geeft de tekst weer tot de gegeven datum, ‘After’ geeft de tekst weer vanaf de gegeven datum en ‘Single’ geeft de tekst uitsluitend weer op de gegeven datum.
Info
Versies
Installatie
Info
Naam: Before And After
Versie: 0.3.2
Status: Stable
Versies
- Versie 0.3.2 – Huidige release
- Diverse bugfixes t.o.v. vorige versie
- Versie 0.3.0
- Wijziging: ON-tag veranderd naar SINGLE
- Gedeelte van de code is herschreven voor flexibiliteit
- Niet backward-compatible met versie 0.2.3
- Versie 0.2.3
- Diverse bugfixes
- Versie 0.2
- Wijziging: Gebruikt de in WordPress ingestelde timezone
- Wijziging: Naast een datum kan nu ook een eind- of vanaf-tijd worden opgegeven
- Toevoeging: ‘ON’-tag voor het tonen van tekst op één bepaalde datum
- Backward compatible met versie 0.1 (zonder tijdsaanduiding)
- Versie 0.1 – Eerste release
Installatie
Upload het bestand before-after.php naar je WordPress Plugin directory and activeer de plugin.
Om een tekst weer te geven tot een bepaalde datum, gebruik de volgende syntax:
<before jjjj-mm-dd uu:mm>Tekst</before>
LET OP! ‘BEFORE’-tags zonder tijdsaanduiding geven de gegeven tekst weer tot de gegeven datum.
Om een tekst weer te geven vanaf een bepaalde datum, gebruik de volgende syntax:
<after jjjj-mm-dd uu:mm>Tekst</after>
Om een tekst weer te geven op een bepaalde datum, gebruik de volgende syntax:
<single jjjj-mm-dd>Tekst</single>
LET OP! De ‘SINGLE’-tag kent geen tijdsaanduiding. Het meegeven van een tijdsaanduiding met de ‘SINGLE’-tag resulteert in het tonen van de tijdsaanduiding op de gegeven datum!
Als er geen tijd wordt opgegeven (versie 0.1 style tags), wordt de tijd in het geval van ‘BEFORE’ op ’00:00′ gezet en voor ‘AFTER’ op ’23:59′. Er is geen limiet aan het aantal tags dat gebruikt kan worden in een artikel. De plugin werkt op zowel posts als pages. Er vind geen controle plaats op de juiste formattering van de datum en tijd. Onjuist geformatteerde datums en tijden kunnen dus zorgen voor ongewenst resultaat!
De plugin ondersteunt geneste tags, zolang de tags niet genest zijn in zich zelf. Zie hieronder voor twee voorbeelden:
Dit voorbeeld werkt wel:
<before jjjj-mm-dd uu:mm;>Deze werkt wel
<single jjjj-mm-dd>, zelfs vandaag</single>.
</before>
Dit voorbeeld werkt niet
<before jjjj-mm-dd uu:mm>Deze werkt niet
<before jjjj-mm-dd uu:mm>, zelfs niet tot morgen</before></before>
What a really clever idea. I haven’t tried it yet but I am impressed with the logic.
Seems pretty neat – but I’m having trouble with the ‘after’ tag. It looks like it works, but only for date changes, not time changes. So I can put it in WordPress as … text… (which is later this afternoon) and the text shows up. If I change the time to 23:59, it still shows up. If I change the date to 2011-11-16 and the time to 00:00, it disappears.
Maybe I’m not understanding the functionality quite right, but this doesn’t seem like the way it should work. Any suggestions/fixes?
Whoops! That code should be:
Hello Jen, thanks for your reply. So far, I had no problems using plugin, which is saying nothing actually 😉 As soons as I can find the time, I’ll look into it and if necessary, I’ll post a updated versions.
Thanks for the heads-up!
I am trying to insert a variable into the tags, using the following code.
<BEFORE >This link should appear for ten days before publication, on . If you can see it after that, then something is not working.
<AFTER >This link should appear ten days after publication, on . If you can see it before then, something is not working.
The plugin is not accepting the variable. It is not working.
Can you suggest a solution>
Hello Kirk,
The plugin wasn’t designed to incorporate variables. It looks specifically for a formatted date. If that’s not found, it does essentially nothing.
When I can find the time to work on the next version, I’ll see of I can incorporate the use of variables. No promises though
Hi Jacob!
Good work on this plugin.
One question: instead of using text as the output can I use shortcodes? Will it work?
Thank,
Bruno Coelho
@Bruno: Normally, the plugin shows (or not) anything between the tags, wether or not that be text or shortcodes. The only thing is that the plugin that works with the aforementioned shortcode could stop working. Before And After (my plugin) doesn’t doe anything with the text/codes between the tags. But if you can post a example, I could always test it for ya 😉
I have added the file to my plugin directory and activated the plugin. However, it does not work! The text between the tags is always displayed. What am I doing wrong?
Thanks,
Klara
Klara, can you post the code you’ve used? Just use the pre-tag in the comments. Without it, I cannot tell you what, if anything, is wrong.
[…] Before And After allows scheduling of text within posts and pages. […]
[…] Before And After allows scheduling of text within posts and pages. […]
What time zone does this operate in… because it is 11:20 PM ET in the US on 12-03-2012 and this plugin is displaying content set to display on 12-04-2012 and the server is located in MT US.
Chip, the plugin should use the timezone set in your WordPress-installation, but for some reason, that line is commented out. I’ll update the download as soon as possible.
Apologies for this screw-up.
Chip, today I’ve uploaded a new version of the plugin (v0.3.2). This version should take your own timezone into consideration. However, WordPress does not automatically update DST, so that’s something you should check.
Moet je dezelfde tijd gebruiken voor BEFORE en AFTER?
Als ik bijvoorbeeld 10.00 gebruik voor beiden,
Dan heb ik tot 10.00 de BEFORE tekst, dan een minuut géén tekst en vanaf 10.01 de AFTER tekst.
Dus gedurende 59 seconden staat er geen tekst op de site.
Indien ik 2 verschillende tijden gebruik, zie ik enkel de BEFORE tekst, geen AFTER tekst.
Ik heb overigens die timezone lijn vooraan uitgecommentaard, maar dit werkt schijnbaar nog niet helemaal zoals het moet. In mijn geval ‘denk’ de plugin dat het 1 uur later is dan werkelijk op mijn server.
Frank,
Ik zal proberen dit weekend jouw voorbeelden te testen. Er zit zowieso een rare fout in de plugin die ik tijdens het testen niet ben tegengekomen, dus de bedoeling is dat ik uiterlijk dit weekend een nieuwe versie online zet.
Over je tijd-probleem met de tijdzone: WordPress doet nog niet aan automatische Daylight Savings Time, dus je moet twee keer per jaar handmatig de tijd van je website aanpassen.
Was nog vergeten te vermelden dat de ON tekst zichtbaar staat tegelijk met de AFTER tekst …
Frank, je probleem zou moeten zijn opgelost met de nieuwe versie. Excuses voor de gruwelijke vertraging! Laat me even weten of de nieuwe versie voor jou doet wat hij zou moeten doen!
Why do that and tags get deleted if you view the page in “Visual” mode?
[…] one is called Before And After, and you’ll find the download here http://www.jacobfresco.nl/wordpress/before-and-after/ by clicking the little silver arrow at the bottom of the description. The site is in Dutch, so you […]