Okay I see the empty category issue you're talking about now. There's really not a good way to accomplish that with Views filtering and conditional logic. I could provide a JavaScript solution that will hide all the empty section headers if that's something you might be interested in.
Yes, that would be great!
Okay I have added this JavaScript in Layouts CSS and JS:
jQuery(document).ready(function(){
jQuery('.wpv-hide-empty-header').each(function(index, item) {
if(jQuery(item).find('li').length < 1) {
jQuery(item).prev().hide();
}
});
});
I have made one modification in the Category-ApparelAndAccessories View. I added the class "wpv-hide-empty-header" to the ul just after the Apparel and Accessories h4 tag. Now this h4 element will be hidden if both these conditions are met:
1. The ul contains no li items, i.e. no results are found in the View.
2. The h4 tag is the immediately previous sibling of the ul tag.
To apply this fix to all the other Views used in the Shows template, you must make sure the h4 tag is just before the ul tag, and you must add the class "wpv-hide-empty-header" to the ul tag in that View's Loop Output editor. This fix will apply to any page of your site that uses a Layout.
Let me know if you have any questions.
Almost, but not quite...the new function seems to be causing a side effect of hiding all my listings (hidden link). Not sure why that might be happening.
Also, it leaves a newline for each empty category. Can that be fixed?
Almost, but not quite...the new function seems to be causing a side effect of hiding all my listings (hidden link;
I'm pretty sure you have some other issue here, it's unrelated to the code I put in place. As a test, I have commented out the code in Layouts CSS and JS and there were still no results displayed here. Screenshot attached. You can delete all the code there if you'd like to test this out. I've reverted the code for now so you can work on the other issue, empty spaces.
Also, it leaves a newline for each empty category. Can that be fixed?
I can help with this if you modify your Layout and place all the Views in a single container. You can do this by replacing all the existing View cells from multiple rows with a single Visual Editor cell, then placing all the individual Views inside that editor cell using the Fields and Views button to generate shortcodes. Otherwise you have a lot of HTML markup surrounding each section that is going to cause empty space.
Newlines - Yes, please help. Thank you!
Any ideas about why the listings stopped loading? It was working last night, and the only thing that I've changed is the show layout and adding all the new views.
Note:
I say that everything was working fine last night, but there is one caveat to that statement. The links below all loaded correctly, however, there was a weird problem with the first link. It would take forever to load and sometimes hang. If I refreshed, it would generally reload fine. Unlike today's problem though, the whole page would be blank, rather than just failing to lead the listings like it is today.
hidden link
hidden link
hidden link
I figured out the problem with the missing listings, although it revealed what I believe is a bug. It's a problem that I've hit several times now. I think it's caused when duplicating views. Should I describe the bug here, or is there a better place to report it?
Please open a separate ticket for the duplicated Views issue you mentioned - that will need to be investigated and tracked on its own. Before you submit that ticket, I recommend enabling server logs to see if there are any server-side errors causing problems. Go in your wp-config.php file and look for define(‘WP_DEBUG’, false);. Change it to:
define('WP_DEBUG', true);
Then add these lines, just before it says 'stop editing here':
ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
Reload the vendors page a few times. If you get a white screen because of a server error, this will create an error_log.txt file in your site's root directory. Attach its contents to your new ticket. Once that is done, you can revert the updates you made to wp-config.php.
I'm taking a look at the newlines now, standby.
Sorry I must not have been very clear about what I need from you to resolve the empty space / new line issue. Take a look at the screenshot posted here. Each of these View cells is contained in a separate Layout row. This is part of the problem, because each row is surrounded in HTML markup, contributing to the spacing issue you have noticed.
I need you to remove all these rows (from Row 9 down to the very last row). Then create a new row with a Visual Editor cell in it, and place all your Views inside that Visual Editor cell. You can place your cursor in the Visual Editor cell, then click the "Fields and Views" button to insert each View.
This will prevent extra markup from showing around each "row", and help resolve the spacing issue. Let me know if you have questions or concerns about this.
Got it! I still have to go through and finish adding them all again, but that looks like it worked.
And I will check out the error log that you suggested as well.
Thank you so much for all your help.