Hello Waqar,
I would like to organize a post archive. For each post will be selected a topic form a custom taxonomy.
Before arrive in an WordPress Archive I’ve created a page with the first view (nested).
Listing Top-level Arguments
Taxonomy - Arguments
Filter: select taxonomy terms parent: None.
Cycle (Ordered list ):
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<ol class="wpv-loop js-wpv-loop">
<ol type="A">
<wpv-loop>
[wpv-post-body view_template="loop-item-in-listing-top-level-arguments"]
[wpv-view name="listing-sub-arguments" cached="off"]
</wpv-loop>
</ol>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"][/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]
Listing Sub-Arguments
Taxonomy - Arguments
Filter: select taxonomy terms parent: parent view
Cycle (Bootstrap grid [4]):
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<div class="container wpv-loop js-wpv-loop">
<wpv-loop wrap="1" pad="true">
[wpv-item index=1]
<div class="row ">
<div class="col-md-12">[wpv-post-body view_template="loop-item-in-listing-sub-arguments"]</div>
[wpv-view name="post-taxonomy-group" cached="off"]
</div>
[wpv-item index=other]
<div class="col-md-12">[wpv-post-body view_template="loop-item-in-listing-sub-arguments"]</div>
[wpv-item index=pad]
<div class="col-md-12"></div>
[wpv-item index=pad-last]
<div class="col-md-12"></div>
</wpv-loop>
</div>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"][/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]
Post Taxonomy Group
Post Types Articles
Filter: Topics are: Set from the parent taxonomy view
Cycle (Ordered list ):
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<ol class="wpv-loop js-wpv-loop">
<wpv-loop>
<a>[wpv-post-body view_template="loop-item-in-post-taxonomy-group"]
</wpv-loop>
</ol>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"][/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]
Final output I would to have is in the image attached.
But, if I have to posts with same topic I don't want have more than one topic.
So, I tried to insert into the View's Loop Output editor JS panel:
jQuery(document).ready(function(){
var strs = [];
var dupes = [];
jQuery('.wpv-loop').find('li > a').each(function(index,item){
var txt = jQuery(item).text(); if( strs.indexOf(txt) > -1 ) {
dupes.push(index);
} else{
strs.push(txt);
}
});
dupes.reverse();
for(var i=0; i<dupes.length; i++) {
jQuery('.wpv-loop').find('li').eq(dupes[i]).remove();
}
});
What I have to update?
Thanks!!!! 🙂
Marco