Its been many weeks now I am trying to use the Vantage Theme along with PageBuilder to develop a website for eCommerce. because
1. most of the available eCommerce plugin do not work with Vantage, it breaks something or the other, when the complexity of the site increases or use of other plugin.
2. Many of features in the eComm Plugin is a overkill for my requirements.. or the Price of the plugin although reasonable but licence terms of per year or per site complicates life.
The progress till now has been a lot of pain but learning also, for I am noob with WP..
The support from the SiteOrigin Team has be good. although I wished they could provide advance support ( may be paid ). I hate one of the standard reply which I see “beyond … this is more of development / customisation”
for now I am releasing the following code, which i used to modify the query for the loop.
Vantage used the following hierarchy.
a) for custom type post Archive: Archive.php or archive-cpt.php and both of these php call loops/loop-grid.php through “get_template_part” which consist the loop to get the all the post.
b) for getting the Archive of Taxonomy ( custom category or Tags): archive.php if taxonomy.php does not exist,
We can create a template for each taxonomy { taxonomy-my_taxonomy.php } or more detailed for each terms of the taxonomy { taxonomy-my_taxonomy-my_term.php } and further create loop-my_term-grid.php and customise the loop.
For me the above is an outright pain, hence I prefer to use one template taxonomy.php and use the hook “pre_get_posts”. this workflow solve the following
I have 5 types of Custom Post Types( CPT) and many of them share same taxonomy. The issues is when the archive loop by default vantage theme pulls post from both or all the CPT. In this case the Product CPT shares Taxonomy ( its not clear in the code but let me explain Product CPT has a Taxonomy “Brand” and also Manufacture CPT also shares the Taxonomy “Brand”, hence when you want to show all post with Taxonomy “Brand” its shows Products of the brand instead of only brand.
Let me make it clear the following code is not the only method to go about this, “rewrite slug” on the Custom Post can also be used.
I have already taken more bal bal.. I shall post the details on my blog
/* to copied into function.php of your child theme */ function tsk_modify_query_of_loop( $query ) { // return for non archive if ( ! is_admin() || ! is_home() || ! is_single() ) { if ( $query->is_main_query() && $query->is_archive() ) { // now get the tax $current_term = get_queried_object(); // $taxonomy = get_taxonomy($current_term->taxonomy); // $taxName = $taxonomy->name; $taxName = $current_term->taxonomy; if ( $query->is_tax( $taxName ) ) { // if ($query->is_tax($taxName)) does not make sense as get_queried_object(); // returns the taxonomy // but not sure, if the main_query may be for other loops..? $postType = array( 'cameratypes', 'va', 'ipratingtypes', 'applicationtypes', 'cameraaccessories' ); // taxonomy unique to the Custom Post Type Product, have to include // "product" to list all post containing the unique taxonomy if ( 'typeofproducts' == $taxName ) { $postType[] = 'product'; } $terms = get_terms( $taxName , array( 'fields' => 'ids' ) ); $taxquery = array( 'relation' => 'OR', array( 'taxonomy' => '$taxName', 'field' => 'id', 'terms' => '$terms', 'operator'=> 'NOT IN' ) ); $query->set( 'post_type' , $postType ); $query->set( 'tax_query', $taxquery ); } } } return $query; } add_filter('pre_get_posts', 'tsk_modify_query_of_loop');
your can email me for any clarification, due to spams, pls visit my blog and post a comment or submit through contact form
When the website is fully developed I shall post a TuT.. for now you can click the URL link issue URL to see the progress.
happy coding
Srikanth Kamath
http://tskamath.pactindia.net
URL: http://tsktech.in
i have some request on the changed Grid of Loop-grid the code is a s follows
edit the Custom CSS or Edit the “style.css” in your child theme