Skip Navigation

[Resolved] WordPress custom archives not working as expected

This support ticket is created 6 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 9 replies, has 2 voices.

Last updated by Christian Cox 6 years, 8 months ago.

Assisted by: Christian Cox.

Author
Posts
#612837

I am trying to set up custom wordpress archives. I've SELECTED WooCommerce Views plugin default product archive template.

And yet I SEE BOTH
WooCommerce Plugin Default Archive Template + WooCommerce Views plugin default product archive template.

I see double! Can you help me to find out whats going on?

I am using Avada theme + WooCommerce Min/Max Quantities/WooCommerce/W3 Total Cache/ThreeWP Broadcast Premium Pack/Nav Menu Roles

#612984

Hi, I'll be glad to take a look. Please try these troubleshooting steps first:
- Temporarily activate the parent Avada theme, then deactivate all plugins except WooCommerce, WooCommerce Views, Toolset Types and Toolset Views. Test the product archive again.
- If you no longer see double archives, please reactivate your child theme, then other plugins, one by one until the conflict is revealed. Let me know what you discover.
- If you continue to see double archives after deactivating other plugins and your child theme, please take screenshots in wp-admin showing the entire WordPress Archive editor screen.

#613029
Screen-wordpress.jpg

I have deactivated all plugins and changed theme. It only works when i deactivate WooCommerce.

Here is a screenshot of wordpressarchive editor...

hidden link

#613063

Okay thanks for the additional information. I'm looking at your site here:
hidden link

I don't see duplicate archives. I see links to each product category archive at the top of the page, including a linked image for each category and a post count. If you want to disable these links, you can add the following CSS to your WordPress Archive's Loop Output CSS panel:

.archive.tax-product_cat .product-category.product {
    display: none;
}

After those product category links, I see a single loop of 8 results because there are 8 posts with the BBQ term. Each result looks like an empty black rectangle, because the Loop Output of your WordPress Archive isn't quite right. Let's analyze that code:

<a href="/partners?wpvproductcategory=[wpv-taxonomy-slug]">

The wpv-taxonomy-slug shortcode is for use in a Taxonomy View, not a Taxonomy Archive. Taxonomy Archives loop over Posts, not Taxonomy terms. So if you want to know the slug of the current taxonomy archive term, you must use the wpv-taxonomy-archive shortcode:

<a href="/partners?wpvproductcategory=[wpv-taxonomy-archive info='slug']">

Next this code:

<img src="[types termmeta='categorie-thumbnail' size='medium' output='raw'][types]" alt="" />

Since an archive loops over posts and not terms, you can't get term custom field values without more information. You need to know the term ID, so you can pass that into the types field shortcode. This way the shortcode knows where to look for this field information:

<img src="[types termmeta='categorie-thumbnail' size='medium' output='raw' id='[wpv-taxonomy-archive info='id']'][types]" alt="" />

Finally the taxonomy title code:

<h2>[wpv-taxonomy-title]</h2>

Again, you cannot access the taxonomy title using this shortcode. The wpv-taxonomy-title shortcode only applies to Term Views. Use the wpv-taxonomy-archive shortcode again:

[wpv-taxonomy-archive info="name"]

More information about the wpv-taxonomy-archive shortcode:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-taxonomy-archive

More information about the Types field shortcode:
https://toolset.com/documentation/customizing-sites-using-php/functions/#image

#613184

Hey Christian,

Thank you for the detailed feedback! I believe i understand it more now! !! Things are still not working as expected though. I don't know if its me or the code.

This code does not do any thing

.archive.tax-product_cat .product-category.product {
    display: none;
}

This code does nothing for me as well. Can i just copy/paste your code or do I have to change something?

<a href="/partners?wpvproductcategory=[wpv-taxonomy-archive info='slug']">

This code made a difference. It added BBQ-thumbnail. But its not of the images(catagories) i expect to see

<img src="[types termmeta='categorie-thumbnail' size='medium' output='raw' id='[wpv-taxonomy-archive info='id']'][types]" alt="" />

I see the same title repeat itself. I expected to see different category titles

[wpv-taxonomy-archive info="name"]

Example of result: hidden link

Am i overlooking something again?

#613469
with-prod-css.png
without-prod-css.png

This code does not do any thing

.archive.tax-product_cat .product-category.product {
    display: none;
}

Yes, it does! See the difference in with-prod-css.png and without-prod-css.png. When the code is added, the category links at the top disappear. When the code is removed, the category links at the top reappear.

This code does nothing for me as well. Can i just copy/paste your code or do I have to change something?

<a href="/partners?wpvproductcategory=[wpv-taxonomy-archive info='slug']">

This should work as-is. Could you please copy + paste the entire contents of the WordPress Archive's Loop Output editor here for me to review?

This code made a difference. It added BBQ-thumbnail. But its not of the images(catagories) i expect to see...
I see the same title repeat itself. I expected to see different category titles
May I ask, why do you expect to see different category titles and category images in each of the "BUFFETSCHOTEL" blocks on this page?
hidden link
A Taxonomy WordPress Archive does not loop over taxonomy terms. It loops over posts that are associated with a specific term, in this case "buffetschotel". So each of those blocks represents a post that is associated with the term "buffetschotel". When you add the image tag inside the wpv-loop tags, the same image will be repeated with each result (each post) in the loop. So I'm not quite clear what you're trying to accomplish here.

#619617

Hello,

Thank you for the feedback. I will have to read the documentation very carefully to fully understand but I will get there.
I have experimented some the last couple of weeks with the customization of wordpress archives with views/types.

What I am trying to achieve is the same as the default wordpress archive. An archive that displays the woocommerce product categories. I would like to build if even further that when you click product categories you will then see sub categories or the products if there are no sub categories.

I have gotten it partially working but not fully. I have got the following code to work:

.archive.tax-product_cat .product-category.product {
    display: none;
}

The problem is that I still see all the images and filter functionality when the page is loading. It dissapears after the page is done loading which is not so handy. I would like to not see the archive at all..

Is there an other way to load custom wordpress woocommerce archives without it loading the default archive content ??

Example:
hidden link

#619748

The problem is that I still see all the images and filter functionality when the page is loading.
Remove the CSS from the Content Template CSS panel and place it in Appearance > Customize > Additional CSS. This will place the code before the page contents, and should resolve the delayed effect.

#625212

Great, Thank you... Is it possible to chose for product categorie archives and then filter by custom post type ?

#625388

Sorry, there is not a built-in way to let Users filter taxonomy archives by post type. It's possible to filter a View by post type using some custom code, but unfortunately we do not offer an API for filtering archives so I don't have any sample code available to help accomplish that.