Articles Field

Connect other articles to your content item

  • Last updated: 12 Jun 2019
  • Version: 3.0.0
  • Type: Custom Field plugin
  • Joomla rating: 97%

Tutorial for Articles Field

There is a Free and a Pro version of Articles Field.
The parts in this tutorial that only concern the Pro version will be marked with: Pro only

Introduction

Articles Field by Regular Labs is a Joomla! custom field plugin that greatly extends the capabilities of custom fields.

With the native Joomla! lists fields, the values are only treated as plain text and cannot be linked to any other content.

The main "Articles" Field type (articles) plugin is a custom field that gives you the ability to choose from a list of articles (based on the selected filters), allowing you to directly connect articles to each other.

The result displayed on the frontend article is a list of the selected articles, that can be hyperlinked to the respective articles, and even displayed with a custom layout (title, custom fields, and other article data).

You can determine which articles show up in the custom field select list by optionally filtering it by categories. The Pro version allows you to also filter the list of articles by tags, authors, language, and other custom field values.

The Pro version also comes with an additional plugin: the "Articles - Linked" Field type (articleslinked) .
The "Articles - Linked" Field type adds the ability to automatically show, in an article, all the articles that are linked to it via instances of the "Articles" Field. This makes it possible to have both articles automatically link back and forth to each other.

Usage Example

Here is an example of how you can use Articles Field.

Say you have a website about Movies. You have 3 main categories with articles: one for the "Movies", one for the "Actors" and one for the "Directors".

On each Movie page you want to list the Actors and the Director(s) associated with that movie, linking to their respective article page:

  • Create two custom field instances of the "Articles" Field, and assign them to appear on articles of the "Movies" category.
  • Name one custom field "Directed by" and set the Filter by Categories to the "Directors" category.
  • Name one custom field "Cast", and set the Filter by Categories to the "Actors" category.

Now when you create/edit a Movie article, you will see these two custom fields. One will list all the "Directors" articles and the other all the "Actors" articles. You can select the actors and the director(s) from those list fields.

When you go to the Movie article on the frontend of your website, you will now see the output of the two custom fields. Each will list the selected articles (actors and directors) as clickable titles. Clicking on one of these will take you to the respective article.

And what if in each Actor page you want to automatically show all the Movies where the actor starred in? You can do this with the Pro version of Articles Field:

  • Simply create an instance of the "Articles - Linked" Field, name it "Starred in", and assign it to appear on articles of the "Actors" category.
  • In the Linked Fields setting, select the "Cast" custom field.

This will show in the frontend a list of movies that are linked to an Actor via the "Cast" field of the "Movies" category. Now when you create/edit an Actor article, you have the ability to switch on a field to show the linked movies articles.

Field Types

Articles Field comes with two different Field Types: "Articles" and "Articles - Linked". The second is only available in the Pro version.

Articles

This "Articles" field type (articles) is the main usage of Articles Field, which is available in the Free version.

This will give you the ability, when you create/edit an article, to select from a list of articles that you want it to link to. In the custom field settings you can decide whether to allow Multiple articles to be selected or not.

The result displayed on the frontend article view will be a list of the selected articles. By default, Articles Field will output the list of articles as linked titles, but you can also completely customize the layout.

When you create an "Articles" Field, you can use different Filters to limit the articles available to be selected.

With the Free version you can filter the articles by one or more Categories. You can even select to filter by the category currently selected in the article where you place the custom field:

The Pro version also allows you to filter the list of articles by Tags, LanguageAuthors, and other Custom Fields values:

Articles - Linked Pro only

If you have already created one or more "Articles" fields, you might want to also show, inside a linked article, the list of articles that are linked to it via these instances of Articles Field.

You can do this in the Pro Version with the alternative "Articles - Linked” field type (articleslinked).

This makes it possible to have both articles automatically link back and forth to each other. Check the second part of the Usage Example for a practical example.

With the Linked Fields setting, you can specify to only display articles linking to the current article via certain "Articles" fields. And you can also limit the displayed articles by all the other Filters as well ( Categories, Tags, LanguageAuthors, and other Custom Fields).

When using the "Articles - Linked" field type, in each article editor you will be given the ability to switch on the field to show the articles that are linked to it. By default, it will be set to "Hide", meaning you will have to set it to "Show" for the articles where you want to show the linked articles.

However, if you prefer to have it set to "Show" by default, you can simply give the custom field a "Default Value" of 1 in the custom field settings:

Controlling the Output

Regardless of which Field Type you're using, Articles Field allows you to fully customize the way the linked articles are displayed in the frontend of the website.

Ordering

First of all, you will be able to choose the order of the displayed articles. You can choose between the following orderings:

  • Ordering (in the "Articles" manager)
  • Title
  • Alias
  • Hits
  • Created Date
  • Modified Date
  • Published Date

You can then specify the ordering Direction, setting it to be either Ascending or Descending.

Layout

By default, Articles Field will output the list of articles as linked titles. But you can change this behavior.

You can choose whether to add a Link to the article title or not. And you can select between three different layout options:

  • Title: Simply show the title of each linked article. This is the default setting.
  • Title + Custom Field: Show the title of each linked article along with the value of another custom field.
  • Custom HTML Pro only: Completely customize the layout of each linked article, using HTML and any article data. See more details below.

Custom HTML Pro only

With the Pro version of Articles Field you can define a custom HTML output for each article.

This allows you to place any article data and have full control over how to style it.

When selecting the "Custom HTML" layout option, the default example value will show a linked title and the number of article hits:

<a href="[url]">[title]</a> ([hits])

You can use [data] tags to output any data available in the article content table. This includes:

  • [id] the ID of the article
  • [title] the Title of the article
  • [alias] the Alias of the article
  • [introtext] the Intro Text of the article
  • [fulltext] the Full Text of the article
  • [catid] the ID of the Category attached to the article
  • [created], [publish_up], [publish_down], [modified] the creation, published and modified dates
  • [created_by], [modified_by] the ID of the article author and article modifier
  • [image_intro], [image_fulltext] the url of the Intro Image and Full Article Image attached to the article
  • [hits] the number of views that the article received
  • [field-name] any other available Article Data (must match the column name in the article database table), for example: [metakey]
  • [my-custom-field] the value of any Custom Field attached to the article. Use the name of the desired field, for example: [location].

So if you have a custom field called "Location" (with name location) and you only wanted to show that as the output, without any link to the article, you could simply use:

[location]

Note: In case of multiple articles with the same value, Articles Field will filter out any duplicate values.

And nothing stops you from creating your own completely customized Layout, combining html and data tags. For example:

<div class="item">
	<div class="pull-left item-image">
<a href="[url]"><img src="[image_intro]" title="[title]" alt="[title]" /></a> </div> <h2><a href="[url]">[title]</a></h2>
</div>

More Data Tags

If you need more control over the [data] tags you want to display, you can extend the possibilities by combining Articles Field with another Regular Labs extension: Articles Anywhere.

As you may know, with Articles Anywhere you can insert any Joomla articles data anywhere in your site. That means you can also use it inside the Custom HTML Layout of Articles Field!

With Articles Anywhere installed in your site, you can use it inside Articles Field by surrounding your code with a starting {article [id]} tag and an ending {/article} tag. Note that the [id] part is important, as it's what tells Articles Anywhere the ID of the linked article to display data from:

{article [id]}...{/article}

This allows you to take advantage of the full range of Data Tags offered by Articles Anywhere, along with their respective options, such as Category Data, Text stripping, formatting Date fields, Images from content, Image Resizing, and much much more.

It even makes it possible to use If Structures inside the Custom HTML Layout.

Here is an example of using Articles Anywhere Pro inside Articles Field:

{article [id]}
<div class="item"> <div class="pull-left item-image">
[link][image-fulltext height="50"][/link] </div> <h2>[link][title][/link]</h2>
[category-link][category-title][/category-link] </div>
{/article}

Combine with Other Plugins

Articles Anywhere is not the only plugin you can combine Articles Field with.

Infact, you can use any plugin tags inside the Custom HTML Layout. This includes Modals, Tooltips, or any other plugin you want.

Here is an example to open the linked article in a Modal popup instead of in a new page.

{modal url="[url]"}[title]{/modal}

Bulleted / Numbered Lists

Since the Articles Field Custom HTML Layout pertains to each individual article, it's a bit tricky if you wanted to display the linked articles in a bulleted or numbered list.

Since Joomla 3.9, you can create and assign alternate layouts for the rendering of a custom field, which makes it therefore possible to add any code around the output of the whole custom field.

Using this feature (see instructions), you could create an alternate layout file (for example called ordered-list.php) where you surround the field $value with <ol></ol> tags. Then, assign this layout to your custom field in "Options > Render Options > Layout".

Now, in the Articles Field Custom HTML Layout, you can simply surround the article output with <li></li> tags.

<li><a href="[url]">[title]</a></li>

Alternate Layout for Articles Anywhere

What we have learned so far controls the output of the linked articles in the article page.

But what if you are also outputting this Articles Field somewhere else in your site through Articles Anywhere, and you would like to display it with a different layout there?

Check out the dedicated guide and example on how to create an alternate Articles Field Layout for Articles Anywhere.

Separator

This setting allows you to choose the separator to use between the various articles when displayed in the frontend.

By default, multiple articles will be separated with a comma.

You can change the separator to whatever you want, and you can also opt to not have any separator at all. The latter option could be useful for example when using a Custom HTML Layout.

Settings

Articles Field is packed with options, giving you control over how it works and behaves. Here is the full list of the options you can find when creating and setting up a Custom Field of type "Articles" and "Articles - Linked".

Articles

Multiple Allow multiple values to be selected.

Articles - Linked Pro only

This field will show articles linking to the current article (via other Articles Fields).

Linked Fields Select the Articles Fields through which other articles are linking to the current article.

Filters

Filter by Categories

Categories Select the categories to limit the articles by. Only articles under these categories will be displayed.
You can also select "Current" to make it use the category set in the current article.
Include child items Also include child items of the selected items?
Options: No, Yes, Only

Filter by Tags Pro only

Tags Select the tags to limit the articles by. Only articles that have any of these tags will be displayed.
Include child items Also include child items of the selected items?
Options: No, Yes, Only

Filter by Language Pro only

Language Select the language to limit the articles by. Only articles assigned to this language will be displayed.
You can also select "Current" to make it use the language set in the current article.

Filter by Authors Pro only

Users Select the users to limit the articles by. Only articles created by these users will be displayed.

Filter by Custom Fields Pro only

Custom Field Select the custom fields to limit the articles by. You can limit articles for up to 3 custom fields.
Field Value Only articles having the given values for the given custom fields will be displayed.

Order

Order Order items will be displayed in.
Options: Ordering, Title, Alias, Hits, Created Date, Modified Date, Published Date
Direction Sort order. Descending is highest to lowest. Ascending is lowest to highest.

Layout

Layout Select the layout to use. You can override this layout in the component or template.
Options: Title, Title + Custom Field, Custom HTML Pro only
Link Title For Layout: Title, Title + Custom Field:
Select to add a link to the article titles.
Custom Field For Layout: Title + Custom Field:
Select the custom field value to use.
Custom HTML For Layout: Custom HTML
Set a custom HTML as the layout for each element. You can use [data] tags to output available article data.
Separator Choose a separator for multiple elements. You can also opt to not have any separator.

Installation

You can either install Articles Field by using the core extension manager available in the Joomla! Administrator Control Panel, or by using the powerful Regular Labs Extension Manager.

Note: When updating Articles Field, you do not need to uninstall it first. The package will update all the files automatically.

Keep in mind that when you update to a major new version (or uninstall first), you might lose some configuration settings.

Regular Labs Extension Manager

It is very easy to install/update any Regular Labs Extension using the Regular Labs Extension Manager.

Please see the Tutorial for the Regular Labs Extension Manager for more detailed information...

Joomla! Extension Manager

To install via the Joomla! Extension Manager, just follow these steps:

  1. Log into your Joomla administrator;
  2. In the menu, choose: Extensions >> Extensions;
  3. Choose the tab: Install from Web (or enable it if you haven't done so yet);
  4. Select the search field and enter Articles Field and hit enter;
  5. Click on the Articles Field listing;
  6. Click on Install;
  7. Click on Install to confirm.
Installer Web

Or if you need to install the Pro version or cannot install via the 'Install via Web' method for some reason:

  1. Download the extension install file (.zip);
  2. Log into your Joomla administrator;
  3. In the menu, choose: Extensions >> Extensions;
  4. Choose the tab: Upload Package File;
  5. Click on the Choose File button and select the extension zip;
  6. Click on Upload & Install.
Installer Upload

If you have problems installing Articles Field, please try the manual installation process as described here: docs.joomla.org/Installing_an_extension