Quantcast
Viewing all articles
Browse latest Browse all 20145

Reply To: [Assigned] Displaying WooCommerce Products with a Custom Taxanomy

Dear Scarlet,
Thanks for the login details. The View is now working OK. These are the changes I've made to the View (Model Videos 1):

a.) I query by products and I remove the previous filter added previously on taxonomy to check for "Featuring". I would like to add this check on the Views meta HTML later on for simplicity (see below).

b.) Then in the original View, you don't have any codes under View layout -meta HTML. So it is why it won't display anything on the front end. What I did now is to use conditional Views shortcode http://wp-types.com/documentation/user-guides/conditional-html-output-in-views/ to check if the page title matches with the featuring taxonomy name. This is the complete working code for the Views layout meta HTML:

[wpv-layout-start]
[wpv-posts-found]
<!– wpv-loop-start –>
   <wpv-loop>         
     [wpv-if evaluate="'[wpv-post-taxonomy type="featuring" format="text" show="name"]' = '[wpv-post-title id="$current_page"]'"]
     <a title="[wpv-post-title]" href="[wpv-post-url]">[wpv-post-featured-image]</a> 
     [/wpv-if]
   </wpv-loop>
<!– wpv-loop-end –>
[/wpv-posts-found]
[wpv-no-posts-found][wpml-string context="wpv-views"]<strong>No posts found</strong>[/wpml-string][/wpv-no-posts-found]
[wpv-layout-end]

As you can see, I have this conditional Views shortcode:

[wpv-if evaluate="'[wpv-post-taxonomy type="featuring" format="text" show="name"]' = '[wpv-post-title id="$current_page"]'"]

This will check if the featuring taxonomy name matches with the page title of the current page loaded. For example if the page title is Brooke and the featuring taxonomy name is also Brooke; it will return true and display the products featured image link from WooCommerce

<a title="[wpv-post-title]" href="[wpv-post-url]">[wpv-post-featured-image]</a>

Now that is working, it's up to you to style this one in either grid, table, etc. as you wish(to create a number of columns, desired, pagination, etc.). Make sure you have backup of the original meta HTML code I have added so you can revert or undo if necessary. For details on doing this, you can refer to the following tutorials (on how to do this with Views):

http://wp-types.com/documentation/user-guides/view-layouts-101/
http://wp-types.com/documentation/user-guides/views-pagination/
http://wp-types.com/documentation/user-guides/digging-into-view-outputs/

Please let me know how it goes.

Cheers,
Emerson


Viewing all articles
Browse latest Browse all 20145

Trending Articles