I have tried to build the layout I want using loopers unsuccessfully. I am now trying to build the layout I want using a php file but I cannot find any documentation on how to name the template or where in my child theme it should live. I am using Pro theme.
Hello @stuartborders,
Thanks for writing in! When creating a WC Archive, you only need to have a Looper Consumer. Design the layout by inserting the elements you want to display and make sure to add Assignments and Condition. The layout should work for your Seating category which out the need to add any custom PHP file in your child theme.
To better assist you with your issue, kindly provide us access to your site so that we can check your WC archive settings. Please create a secure note with the following info:
– Link to your site
– WP login URL
– WP username
– WP password
– WP Administrator Role
- Confirmation that we can access and make changes to your site
To know how to create a secure note, please check this out: How The Forum Works
Regards.
Thank you for your help. I added a secure note.
Hi @stuartborders,
What you are expecting may be achieved through multiple nested loopers, the first looper will return the sub-categories of the current category and inner looper will return the products based on the sub-category. But that might be required some experiment and trial and error process. If you want this to be done through any custom page template, you need to build a Custom Page Template into your child theme for this, you need to know how you can create a Page Template. Please go through the following URLs on how you can create that.
- https://www.wpbeginner.com/wp-themes/how-to-create-a-custom-page-in-wordpress/
- https://premium.wpmudev.org/blog/creating-custom-page-templates-in-wordpress/
After you create the template, you can specify the name of the template by adding the following code at the top of the php file and php open tag.
/** Template Name: Your Template Name **/
If you are not proficient on this, I would suggest you hire a developer who can assist you to do the customization or you can avail of our newly launched service called One, where the customization questions are answered.
Thanks
Hi Tristup,
Im curious if you understand how unhelpful that response is? I understand loops and nesting loops. I cannot get the Looper functionality to nest. which is why I asked for help getting a php template location or naming convention to correctly address the issue. You didn’t actually help me with either. I provided my login info so someone could look at it and tell me what I am missing but instead you just responded with a general “you’re dumb” response.
Can you or someone in support help me create a the nested looper correctly or tell me how to name the file and where in the child theme structure to put it to get it to override the page?
Hi @stuartborders,
I am really sorry if my response does not help you. Still, I think that my answer was quite correct on what you are trying to achieve shown in the sample link. I went ahead in my local environment and implemented the nested loop which works and shows almost the exact structure that you are expecting. However, I realized that my answer may be a little complex and should be more generalized.
Thanks
Since you are insisting that you are being helpful and that its possible. Can you tell me how to set up the looper to access subcategory info - Specifically the name, image, and link - for the outer provider? And then how in the inner looper do you specify only products of that sub category?
I guess I don’t understand why me asking a legitimate use case question for your new feature is so hard to help me rather than disparaging me. I have always appreciated and bragged on Themeco’s support of its developers and community. This is such a disappointing experience.
Hey @stuartborders,
We’re sorry about that. You do not need custom PHP template modification as what you need, which is:
can be achieved using our Loopers feature. Check out the setup below.
- Use a Section as the base. That means the Section should be the Looper Provider that will hold All Product Categories.
- Each Row within that Section would output each Product Category so the Row should be a Looper Consumer that will show All Product Categories.
- The Row, following your sample, should be 4 columns but should only actually contain 2 columns because the 2nd one would be dynamic as you’ll see later.
- Add 2 Columns to the Row and immediately add a Button element in the 1st Column. Just note that what I’m driving right now is a simple setup for clarity. Later on, you can add elements as you like.
- The Button element would contain Dynamic Content such as the Product Name
{{dc:term:name}}
.
- You then proceed on setting up the 2nd Column which should be both a Looper Provider and a Looper Consumer. For the Provider setup, choose Query String and for the WP Query, use
product_cat={{dc:term:name}}
. The Consumer setup would be limited to 3 only as per your sample. This would add 2 more dynamic columns in your setup.
- Lastly, add a Button element to the 2nd Column. Similar to the 1st Column Button, the 2nd Column Button will contain Dynamic Content but this time, it will output product data like the Product Title
{{dc:woocommerce:product_title}}
Hope that helps.
Thank you. that is very helpful. One more question though, how do you specify to only pull from that category? so that it pulls the sub-categories and their products? Does it do it automatically given the page?
Hey @stuartborders,
In my test, it automatically pulls products from the sub-category so for example, the Hoodies category has 0 post.
Yet, it shows products from its sub-categories.
If you’re intending to create a “per parent category” template that will show sub-category products, it would need custom development. A sample was provided in this thread WC sub-categories in "Terms (cloud)". You will need to use the cs_looper_custom_subcat
custom looper as your main loop. This is tricky though and we cannot provide in-depth setup help for this as this is quite involved.
Hope that helps and thank you for understanding.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.