Search
Data Tags

Dates

Any Data Tag that has a date value can be output and have the date format specified. These include:

  • [created]
  • [publish-up]
  • [publish-down]
  • [modified]
  • [featured-up]
  • [featured-down]
  • Custom fields of type calendar
[publish-up format="F jS Y"]

April 18th 2024

The date format characters that you can use are based on the PHP date function.

You can also use date values inside If Structures, like:

{if created >= '2019-02-15'}...{/if}

And you can even compare dates to the current date using Relative Dates or the now() value.

{if publish-up > now()}Coming soon{/if}

Modifying Dates J4

Articles Anywhere also gives you the ability to add a certain time or date offset to a Data Tag with a date value.

You can do so by adding a modify attribute, and using any string in there that the PHP date modify function understands:

[publish-up modify="+3 hours"]

Dates Layout

By default, Articles Anywhere will output the Dates as plain text.

However, you can decide to show it in the same style used in the full article view, by outputting it through its respective layout:

[publish-up layout="true"]
[created layout="true"]
[modified layout="true"]

This would output the dates through their respective default layouts, which are located at these paths:

/layouts/joomla/content/info_block/publish_date.php
/layouts/joomla/content/info_block/create_date.php
/layouts/joomla/content/info_block/modify_date.php

Alternatively, in the data tag you are also able to override the default layout with a different one.

You can use the default layouts listed above as your starting base, copy the file to templates/[my template]/html/layouts/joomla/content/info_block/my-date-layout.php, and edit the code to meet your needs.

Now, in the data tag, you can set to use the alternative layout by inserting the path to your file starting from the layouts folder of your template. The subdirectories must be separated with dots:

[publish-up layout="joomla.content.info_block.my-date-layout"]
[created layout="joomla.content.info_block.my-date-layout"]
[modified layout="joomla.content.info_block.my-date-layout"]