Tagged: masonry, shortcode, taxonomy, woocommerce
-
AuthorPosts
-
October 20, 2014 at 12:23 pm #338271
Hi,
I have a taxonomy called “Shop Vendor” (it’s a WooCommerce Extension http://www.woothemes.com/products/product-vendors/) allowing to attach one or more WooCommerce products to a Vendor.
I’d like to use your Masonry Entries shortcode to display the Shop Vendors and not the products attached.
Is it possible to do that ?
I put the shortcode masonry_entries.php in the /shortcodes folder of my child theme. But honestly I can’t find which query I need to modify to achieve my goal.
Thanks for your help!
October 22, 2014 at 1:03 am #339293October 22, 2014 at 7:49 am #339388Yes I see the Shop Vendor taxonomy and when I select it I can see the Taxonomy Terms.
But It only displays the products attached to Taxonomy Terms not the Termes themselves…
Thanks for your help.
- This reply was modified 10 years, 2 months ago by basilefanon.
October 22, 2014 at 3:51 pm #339498Hi!
We use the WP_Query Class to get the content to show in the masonry element, as far as i know there is no way to fetch Taxonomies instead of Posts/Pages/Products/etc.
Best regards,
JosueOctober 23, 2014 at 10:15 am #339984Thx for your feedback but I don’t understand, how you’re able to display the terms in the second dropdown as soon as I select the Shop Vendor taxonomy but on the frontend side, it’s not possible to achieve such thing ?
Thanks in advance for your help!
October 23, 2014 at 5:58 pm #340263Hi!
That’s a different functionality. Correct me if i am wrong, but you want to show the Terms as the masonry content, instead of the Posts attached to that Term?
Cheers!
JosueOctober 23, 2014 at 6:34 pm #340289Exactly. :)
Pleaaaaase tell me it’s possible.
October 23, 2014 at 7:44 pm #340306Problem is that a Term (or a Taxonomy) it’s not a suitable element for WP Query fetching, it is meant to be used for categorization of the content rather than being the content (it lacks of featured images and other meta data like tags, published date, etc).
Do you have an example of what you want to achieve? perhaps there is more WordPress-reliant approach we can think of.
Regards,
JosueOctober 24, 2014 at 3:40 pm #340643Thanks Josue,
To be precise, I want to create a shortcode to display my list of vendor on my site. So far, I’ve been able to create this :
add_shortcode( 'list_vendors', 'wc_list_vendors_shortcode' ); function wc_list_vendors_shortcode( $atts ) { $vendors = ''; $terms = get_terms( 'shop_vendor', array( 'hide_empty' => false ) ); foreach ( $terms as $term ) { $term_link = get_term_link( $term, 'shop_vendor' ); $logo = get_field('logo', $term); if ( is_wp_error( $term_link ) ) continue; $logo_ids .= $logo['id'] . ","; } $vendors .= do_shortcode("[av_masonry_gallery ids='" . $logo_ids . "' items='24' columns='flexible' paginate='pagination' size='flex' gap='large' overlay_fx='active' caption_elements='title excerpt' caption_display='always' container_links='active' id='']"); return $vendors; }
But I can’t apply a link to my image leading to my vendor page. It’s possible if I create the shortcode straight from the post editor but I can do it on the fly, do I ?
Thanks for your help!
October 29, 2014 at 6:51 am #342571Hey!
The custom link is a meta data (“av-custom-link”) attached to the media file, in this case i think you’d need to do that with the term in question, check out /enfold/config-templatebuilder/avia-template-builder/php/media.class.php:87.
Cheers!
JosueOctober 29, 2014 at 4:36 pm #342787Thanks Josue for your feedback.
How can I modify it in my Child Theme ?
I copy the file somewhere in my child theme folder or only the function into my functions.php ?
Thanks for your help.
November 1, 2014 at 12:11 am #344370Hi!
Actually i’m not sure if that would work because i don’t know how are you setting the meta data for these terms (ACF?). I think the answer resides in /config-templatebuilder/avia-shortcodes/masonry_entries.php:771 instead:
$custom_url = get_post_meta( $id, 'av-custom-link', true );
Cheers!
JosueNovember 12, 2014 at 6:23 pm #350197Thx for your answer… So that mean that masonry_entries.php also works with av-custom-link ?
Thx
November 12, 2014 at 6:39 pm #350215Yes, try changing that to a hard-coded value to see if that changes something in your custom masonry:
$custom_url = "http://kriesi.at";
Regards,
Josue -
AuthorPosts
- You must be logged in to reply to this topic.