How to Sort and Limit WordPress Post Links Displayed Using ACF Views Plugin?

[ad_1]

I’m working on a WordPress site where I use the ACF to ACF Views plugins. This is a website where I’ll publish original and translated novels. The chapters and novels are custom post type. The homepage is a query loop of the the novels and each novel has its own custom fields like schedule, status. I also want to have a list of the 3 latest published chapters.
I’m using ACF Views shortcode to display the chapters that are in a bidirectional relationship with their respective novels.
Can someone help me craft a JS code to only have the links to the latest 3 posts and have them in a descended order by time.
I’m using ACF Views simple so I can’t modify the Twig template code.

“`html

<div class=”{{ _view.classes }}acf-view acf-view–id–{{ _view.id }} acf-view–object-id–{{ _view.object_id }}”>

{% if novel_chapter_relationship.value %}

<div class=”acf-view__novel-chapter_relationship acf-view__row”>

<div class=”acf-view__novel-chapter_relationship-field acf-view__field”>

{% for post_item in novel_chapter_relationship.value %}

<a target=”{{ post_item.target }}” class=”acf-view__novel-chapter_relationship-link acf-view__link” href=”{{ post_item.value }}”>

{{ post_item.linkLabel|default(post_item.title) }}

</a>

{% endfor %}

</div>

</div>

{% endif %}

</div>

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer