Comparison Operators PRO

Articles Anywhere also allows you to use different comparison operators to filter your articles by.

Negative Values

To apply a negative filter that excludes certain articles, you can add ! before the value.

So this will show all articles in the category "Cats" that do not have the tag "Cuddly":

{articles category="Cats" tags="!Cuddly"}...{/articles}

You can also apply a negative filter with multiple values, separating them with a comma:

{articles category="!Some Category,!another-cat,12"}...{/articles}

Greater or Less than…

You can apply comparison filters on numeric and date values, by prepending the value with <, <=, > or >=.

For example, if you want to show all articles that have the nr-of-legs custom field value equal or greater than 2:

{articles nr-of-legs=">=2"}...{/articles}

Or to show all articles that have a publish_up date equal or greater than February 15, 2019:

{articles publish_up=">=2019-02-15"}...{/articles}

You can also compare dates to the current date using Relative Dates or the now() value.

Wildcards PRO

You can use the * wildcard to match articles, categories, tags, custom fields or other filters by only a part of the value.

The following syntax will return all articles that have a title starting with "grey":

{articles title="grey*"}...{/articles}

The following syntax will return all articles that have a title containing "cat":

{articles title="*cat*"}...{/articles}

The following syntax will return all articles in categories that have a category name ending in "hound":

{articles category="*hound"}...{/articles}

Empty Values PRO

Output Articles with Empty Values

You can also filter down to articles where a certain field value doesn't exist (meaning it's empty or null).

To do so, simply leave the filter value (between quotes) empty.

The following syntax will return all articles that don't have any tag attached:

{articles tags=""}...{/articles}

The following syntax will return all articles that don't have a value set for the custom field nr-of-legs:

{articles nr-of-legs=""}...{/articles}

Exclude Articles with Empty Values

Viceversa, you can filter down to articles where a certain field value DOES exist (meaning it's NOT empty or null), no matter what the value is.

To tell the filter to show the articles where a value is not empty, use + as the value.

For instance, the following syntax will return all articles that have at least one tag attached:

{articles tags="+"}...{/articles}

Alternatively, you can also use the wildcard to match any value, as long as the data exists:

{articles nr-of-legs="*"}...{/articles}

Dynamic Values PRO

As we seen so far, you can filter articles by specific values. However, you can also use dynamic values!

Same Values as Current Article

If you want to get all articles that have the same value of a certain data as the current article being displayed, you can give the current value to your desired filter.

For instance, to get the articles that are under the same category as the current article, you can simply use: category="current". Or to get the articles written by the same author as the current article, use author-id="current". Even Custom Fields values are supported (my-custom-field="current").

Vice versa, to exclude the current article from the results, you can add articles="!current" to the plugin tag.

Data from Current Article

Any data from the current article that contains the Plugin Tag or is being currently displayed, is also available to be used inside any Filter.

This can prove useful especially in combination with Articles Field, to return the list of articles that are pointing to the Current Article via Articles Field, by utilizing this:id:

{articles my-custom-field="this:id"}...{/articles}

You can also use other article data or custom fields:

{articles my-custom-field="this:alias"}...{/articles}

The this:... values available are explained more in detail in the Data From Specific Article section.

Data from Current User

Data from the user that is logged in the website is available to be used inside any Filter, for example by utilizing the user:id value.

This is particularly useful to return a dynamic list of articles that changes based on the user that is currently browsing the website and viewing that page:

{articles author-id="user:id"}...{/articles}

You can also use other values such as user:username:

{articles my-custom-field="user:username"}...{/articles}

The user:... values available are explained more in detail in the User Data List.

Relative Dates

You can use Relative Dates and Custom Formats inside Filters and If Structures.

This allows to return articles that have a dynamic date value of the current day, yesterday, tomorrow, or any other date relative to today. All Relative Dates can also be combined and used with Comparison Operators or Date Ranges.

For example, to return a dynamic list of articles that have a date of yesterday:

{articles event-date="date('yesterday')"}...{/articles}

To show all articles that have a date in the future:

{articles event-date=">date('today')"}...{/articles}

Or using a Date Range to output the articles published in the last 30 days:

{articles publish_up="date('-30 days') to now()"}...{/articles}

Below you find some more examples of the type of values you can use:

  • now() or date() or date('now') => return current date and time (2024-03-29 01:38:16)
  • date('today') => return current date (2024-03-29)
  • date('tomorrow') => return date of tomorrow (2024-03-30)
  • date('yesterday') => return date of yesterday (2024-03-28)
  • date('-1 day') => return date of yesterday with current time (2024-03-28 01:38:16)
  • date('+2 days') => return date of 2 days from now with current time (2024-03-31 01:38:16)
  • date('-1 week') => return date from 1 week ago with current time (2024-03-22 01:38:16)
  • date('-1 month') => return date from 1 month ago with current time (2024-02-29 01:38:16)
  • date('-1 year') => return date from 1 year ago with current time (2023-03-29 01:38:16)

See the full list of the possible Relative Date Values that can be used.

For any relative date value, you can also customize the date format it should use. Here are some examples:

  • date('today', 'l') => return today's week day name (Friday)
  • date('today', 'F') => return current month's name (March)
  • date('today', 'Y') => return current year (2024)
  • date('tomorrow', 'Y-m-d H:i:s') => return date of tomorrow with time 00:00:00 (2024-03-30 00:00:00)
  • date('yesterday', 'Y-m-d H:i:s') => return date of yesterday with time 00:00:00 (2024-03-28 00:00:00)
  • date('-1 day', 'Y-m-d') => return date of yesterday (2024-03-28)
  • date('+2 days', 'Y-m-d') => return date of 2 days from now (2024-03-31)
  • date('-1 week', 'Y-m-d') => return date from 1 week ago (2024-03-22)
  • date('-1 month', 'Y-m') => return last month in Y-m format (2024-02)
  • date('-1 year', 'Y') => return last year (2023)

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

Note: All Date Filters will be adjusted correctly according to the Time Zone used on your website.

Input Values

Articles Anywhere can also dynamically access data from URL params (query strings) and form inputs, thanks to a special "input:.." value.

This allows you to change which articles are displayed on your page based on the data sent by a form (both GET and POST form requests are supported), or based on a custom parameter added to the URL.

For example, let's use a custom parameter called myparam (but it can be anything you want):

{articles category="input:myparam"}...{/articles}

With this plugin code, you could then customize the category from which the articles are returned, by simply passing a parameter in the URL like:

https://www.mysite.com/my-articles?myparam=Animals

You are also able to set a default value to be used in case the specified parameter is not passed, by adding after the parameter name separated by a colon. For instance, to show articles from the category "World" by default, unless overruled via your ?myparam=... parameter:

{articles category="input:myparam:World"}...{/articles}

Note: If you're using Joomla cache (via Global Configuration, not via the System Plugin), you will need to register these additional URL Parameters as "safe", in order to make Joomla create a unique cache for each page. Articles Anywhere allows you to do this in the "Advanced" tab of the plugin settings (for each extra parameter name, you should also specify what type of value it can be).

Multiple Groups PRO

In some cases, you don't want filters to narrow the result down, but to extend it. You can group different filters by separating the groups with ||.

For instance, you might want to show all articles from the "Dogs" category, plus all featured articles that have the tag "Tiny".

{articles category="Dogs" || featured="true" tags="Tiny"}...{/articles}

You can use multiple filters per group.

Note that any Filters or Filter Settings (like include_child_categories) will be applied to each individual group, so they can be different for each group. However, any Output Settings (like ordering, limit and per_page) will be applied to the whole tag.

So, for example (new lines are just for clarity):

{articles
category="Animals" include_child_categories="true"
|| category="Fruit"
|| tags="Monsters"
limit="10" ordering="title"
}
...
{/articles}

This tag will return only 10 articles in total in alphabetical order, from:

  • the articles in the "Animals" category (including all sub-categories)
  • the articles in the "Fruit" category (NOT including any sub-categories)
  • the articles that have the tag "Monsters".