Skip Navigation

[Resolved] Taxonomy Custom Fields not displaying on empty Category

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a custom taxonomy term archive page that includes some custom fields. If no posts exist in the archive, the custom field values do not display.

Solution: This has been fixed in the latest plugins.

This support ticket is created 6 years, 6 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.

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 10 replies, has 2 voices.

Last updated by Jens 6 years, 4 months ago.

Assisted by: Christian Cox.

Author
Posts
#906808

I have customised the Category / Tag archive pages with some Custom Fields/Term Fields (CFTF). They display a banner using a Toolset CFTF, the WP Category Name, WP Category Description and navigation+map section using a CFTF. An example can be seen at the following link;

hidden link

Prior to the most recent Toolset update, those fields would display correctly in the front end even if the category was empty. After the update, if the category is empty (no posts), the Toolset CFTF's do not display. An example is the following;

hidden link

That link should still display a banner and navigation/map, however because "no items found", the taxonomy term fields do not display. This is a change in behaviour from previous versions and a serious issue for the site's user experience.

I use modified version of the WP Hide Post plugin to hide posts from parent categories. As you see in the first link above, if I 'unhide' a post, the taxonomy term fields display correctly. This is a work-around, however shouldn't the default behaviour be to show custom term fields even if no posts exist?

Can you let me know if this is something you expect to continue as default behaviour, and, if so, let me know how taxonomy fields can be displayed even when no posts are found.

Kind regards,

Jens

#907174

Hi, I'm not aware that the functionality for this should have changed, but I am able to replicate the problem as you described when I use a Types field shortcode in a Taxonomy WordPress Archive:

[types termmeta='fieldslug' output='raw'][/types]

The value of the field simply does not appear if there are no posts associated with the archive current term. I assume this is similar to what you're seeing. Can you share full contents of the Loop Output of this WordPress Archive, so I can confirm we're discussing the same thing? I will escalate this as a potential bug in the new releases as soon as possible, and update you here when I have more information to share.

#907270

I have the fields being displayed through a Layout / Visual Editor cell for the archive.

<h1>[spinach_tag_title]</h1>
[wpv-conditional if="( is_paged() ne '1' )"]
<p>[spinach_category_description]</p>
<div class="spinach-3rem-top">
[types termmeta="taxonomy-secondary-text"][/types]
</div>
[/wpv-conditional]

The spinach_tag_title and _category_description are standard WP fields, these are being displayed. Toolset fields are not. I think we see the same issue.

#907920

Thank you, I have escalated this problem and I am waiting to receive some further instructions from my developers. I will update you as soon as possible.

#911816

Hi, our developers have included a fix for this issue in Types 3.0.1, which is now available at https://toolset.com/account/downloads. Please install the latest version and let me know if the term fields are still not showing as expected.

#913783

Unfortunately it does not seem fixed in my testing. I have installed Layouts v. 2.3.1 and the taxonomy Custom Fields / Terms Fields (CFTF) still do not show if no items are found. Try these links as examples, the first has posts, the second does not, however both use exactly the same CFTF's and the same Layout and Content Templates.

hidden link

hidden link

I modified the previous code I supplied to use Toolset shortcodes to display the standard WP CategoryName and Description. These are displaying as expected. This code is inside a Visual Editor cell within a Layout;

<h1>[wpv-taxonomy-archive info="name"]</h1>
[wpv-conditional if="( is_paged() ne '1' )"]
[wpv-taxonomy-archive info="description"]
<div class="spinach-3rem-top spinach-3rem-bottom">
[types termmeta="taxonomy-secondary-text"][/types]
</div>
[/wpv-conditional]

The termmeta taxonomy-secondary-text CFTF contains contains the shortcode;

[wpv-post-body view_template="new-zealand-regions"]

That Content Template contains code relevant to each category, however the section below shows the code related to the page (above) that does not show the CFTFs. It uses the taxonomy-archive "id" and "name" to conditionally display information;

[wpv-conditional if="( '[wpv-taxonomy-archive info="id"]' eq '19' ) OR ( '[wpv-taxonomy-archive info="parent"]' eq '19' )"]
[wpv-conditional if="( '[wpv-taxonomy-archive info="name"]' ne 'DOC Campsites' )"]
<p class="spinach-1rem-bottom"><img src="/wp-content/themes/spinach/assets/icons/camping.png" alt="Camping Icon" title="Campsites">  <a href="/travel-guide/new-zealand/southern-south-island/doc-campsites-ss/">DOC Campsites "</a></p>
[/wpv-conditional]
[wpv-conditional if="( '[wpv-taxonomy-archive info="name"]' eq 'DOC Campsites' )"]
<p class="spinach-1rem-bottom"><img src="/wp-content/themes/spinach/assets/icons/camping.png" alt="Camping Icon" title="Campsites">  DOC Campsites</p>
[/wpv-conditional]
[/wpv-conditional]

As the information displays correctly in categories that contain posts, I am also wondering whether the issue might be in the theme I am using, one which I created myself as a very basic theme that relies solely on Layouts to display entire pages. This might be completely un-related, however I notice that the Toolset Starter Theme and others have disappeared and the Layouts Theme Integration is pending a re-write;

https://toolset.com/documentation/user-guides/layouts-theme-integration/

In particular the part, "we are transitioning away from using Layouts to design the whole page, and instead focusing on using Layouts to design just the content area of the page, with the theme responsible for generating the header, footer, sidebars etc." has me thinking it may be related to the issue above. The theme I created, some time back in an earlier Layouts version, contains only the index.php file to display all pages and negates the need for me to 'invest' in a separate theme, thus removing the overhead of managing theme updates.

<?php 
/**
* Template Name: Index
*
* The main template file
*
*/
get_header(); ?>
  
<div id="primary" class="content-area">
  	<div id="main" class="site-main" role="main">
    	<?php 
    		the_ddlayout(); 
    	?>
  	</div>
</div>
  
<?php get_footer();

As I said, it might be un-related. I also noticed your downloads page looks a little broken when I checked the changelog.

https://toolset.com/account/downloads/

#914157

Sorry, I've been adding content to the site in the link I used on the preceding reply, therefore the CFTFs are now showing. The banner image and the navigation/icons would not show if there was "no items found".

hidden link

#914422

Okay thank you for the update, I am passing your information back to the development team for further analysis. I'll update you as soon as I can.

#917086

Sorry for the miscommunication on this, we received information that the fix for this problem would be included in 3.0.1 but it did not get merged into the last release. We plan to include the update in the next release, Types 3.0.2. I will be glad to keep you posted here.

#922167

Hi, please find Types 3.0.2 available now for download or automatic update. This new version includes the fix for missing taxonomy term fields in archives. Please let me know if the problem is not completely resolved.

#924495

Thanks for the help.