Separating the Output PRO

The output of the multiple {articles} tag will be whatever output is generated for every article depending on your Data Tags.
This includes any markup you place between the {articles} tags like new lines.

Let’s say you want to list all titles of all the articles in the category "Dogs". And you do:

{articles category="Dogs"}[title]{/articles}
AffenpinscherAfghan HoundAiredale Terrier...Yorkshire Terrier

As you can see all titles are output as one long line without any spaces or lines to separate them.
This behavior might be desired when surrounding the Data Tags with a customized div layout, but in this example, we will most likely want to separate the articles.

To output every title on a new line, you can simply place the closing {/articles} tag on a new line:

{articles category="Dogs"}[title]
{/articles}
Affenpinscher
Afghan Hound
Airedale Terrier
...
Yorkshire Terrier

But what if you want a comma-separated list? To do that, you can use the separator="..." attribute. This will place whatever you put inside the separator attribute between every article. For example:

{articles category="Dogs" separator=", "}[title]{/articles}
Affenpinscher, Afghan Hound, Airedale Terrier, ..., Yorkshire Terrier

Ordering PRO

In the Articles Anywhere system plugin settings you can define the default ordering of the articles returned by the plugin tag.

You can override the ordering in the {articles} tag by adding an ordering="..." attribute.

You can order the output of the articles by a huge range of data types, including any article data, category data, dates, and even by custom field values - pretty much by anything you can think of.

  • title the title of the article
  • alias the alias of the article
  • id the ID of the article
  • hits the number of views that the article received
  • created, publish_up, publish_down, modified the creation, published or modified dates.
  • author-id, author-name, author-username the id, name and username of the article author (Created by)
  • modifier-id, modifier-name, modifier-username the id, name and username of the article modifier (Modified by)
  • category or category-title the title of the category attached to the article
  • category-alias the alias of the category attached to the article
  • category-id or catid the id of the category attached to the article
  • ordering the order in the "Articles" manager
  • featured-ordering the order in the "Featured Articles" manager
  • category-ordering the order in the "Category" manager
  • field-name any other available Article Data (must match the column name in the database table), for example: metakey
  • my-custom-field the value of any Custom Field attached to the article. Use the name/alias of the desired field, for example: nr-of-legs
  • random random order

Ordering Direction

You can then specify the ordering direction with either ASC for ascending, or DESC for descending.

For example, to output all articles from category "Animals" ordered by title (alphabetically) in ascending order:

{articles category="Animals" ordering="title ASC"}...{/articles}

To place all articles in categories "Cats" and "Dogs" in random order:

{articles category="Cats,Dogs" ordering="random"}...{/articles}

Multiple Orderings

You can even specify subsequent orderings to be used, in order of precedence, when the value of the first ordering is the same. You do so by simply separating the multiple orderings via comma:

{articles category="Animals" ordering="publish_up DESC, title ASC"}...{/articles}

There is no limit to how many levels of ordering you can use. If the values of all specified orderings are the same for certain articles, the output will fall back to the default ordering set in the Plugin Settings.

Limit/Range PRO

By default Articles Anywhere will show up to 100 articles matching the given Filters. But in the Articles Anywhere system plugin settings you can change the default limit of maximum articles to be returned.

And you can also individually define the limit for each {articles} tag with a limit="..." attribute.

For example, to place only the first 20 articles from the category "Animals":

{articles category="Animals" limit="20"}...{/articles}

Offset

You can also show a range of articles not starting from the start. For instance, to show articles 11 to 30, you can do:

{articles tags="Cute but Dangerous" limit="11-30"}...{/articles}

Alternatively, you can use an offset="..." attribute to simply exclude the first X amount of articles from the results.

The following example achieves the same result as before, showing articles 11 to 30 (20 articles starting from the 11th):

{articles tags="Cute but Dangerous" offset="10" limit="20"}...{/articles}

One per Category

You also have the ability to limit the results to only return one article per category, by using a one_per_category="true" attribute.

This can prove useful when showing articles from multiple categories (or when including child categories), and only wanting to show one article from each:

{articles category="Animals" include_child_categories="true" one_per_category="true" ordering="publish_up DESC"}...{/articles}

Minimum

You can also define a minimum number of articles that should be returned, by using a minimum="..." attribute:

{articles category="Animals" minimum="3" limit="20" empty="Less than 3 articles found!"}...{/articles}

If the tag (with the specified filters) does not result in at least the set minimum amount of articles, the output will return empty.

Output when empty PRO

Let's say you created a tag to output all articles from the category "Fish" that have the tag "Has legs". But when there are no articles matching these filters, you want to place a little message saying "Currently no fish found with legs!".

You can place this text in the empty attribute:

{articles category="Fish" tags="Has 3 legs" empty="Currently no fish found with legs!"}...{/articles}

Fix HTML PRO

By default, Articles Anywhere will try to fix any HTML structure issues it finds.

In the Articles Anywhere system plugin settings you can control the setting. This is on by default as it’s often necessary to deal with surrounding HTML tags. Only switch this off if you have issues with this.

You can individually override this setting in the {articles} tag by adding a fixhtml="..." attribute with either a true (on) or false (off) value.

{articles category="Penguins" fixhtml="false"}...{/articles}