In this tutorial we will see how to create a simple list with a field listing a number of items.
We click on the ADMIN FORM plugin and then on the "CREATE NEW FORM" button. We write Article list as the name and click on "create a new Table".
Once the list has been saved we will be redirected to the FORM TAB where we can add 2 fields:
field name: title
field Type: Text (single line)
field label: Title
required
field name: Articles
field Type: Post
is multiple: Selezioniamo il checkbox "is multiple"
field label: Articles
Let's save the form
Now it is already possible to load a series of articles for each record.
Now Let's create a different view for the frontend where we add links to the articles
Let's go to the FRONTEND tab and click on "list type" "custom".
In the "In Loop" textarea we add the code:
<h1>[%data.title]</h1>
[%data.Articles json tmpl=[:
<div class="dbp-item-post">
[^POST.title_link id=[%item]]
</div>
:]]
%data.Articles is the name of the field into which we insert multiple posts. These are saved in a text field in json format. [%data.Articles json] converts the json to an array. to cycle the array we use tmpl=[::] Inside the square brackets of tmpl we can use $item to find the individual cycled elements. So $item is the post id. At this point we load the post and print the link with the title.
At the top right or from the "code" tab you can copy the shortcode to view the list. After entering some test data, create a new page and insert the shortcode [adfo_list id=xxx].