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]