Tell us what you are trying to do? I'm using Beaver Builder with views to display staff members. If they have a custom field value in the special title, I'd like it to display, otherwise I'd like the space created removed.
Is there a similar example that we can see?
This is what I've got. hidden link The special title in this case is "Founder of White & Co" for Ivan White. Tom White and James Eric do not have a special title but you can see there is a blank space visible where the results would display if the field had been completed.
Hi, I'll try to help. I assume the fields are placed in a Content Template, and you're editing that with Beaver Builder. Is that accurate? If so, you may need to use Conditional HTML to hide the line break. In the Content Template, if you use the "Text" tab instead of the "Visual" tab, you may see something like this:
...other stuff before your special title field
<br />
[types field="yourfieldslug"][/types]
<br />
...other stuff after your special title field
If your field is empty, then this results in two line breaks back to back, leaving an empty space. You can prevent this by surrounding the field and following break tag with conditional HTML:
...other stuff before your field
<br />
[wpv-conditional if="(NOT(empty($(wpcf-yourfieldslug))))"]
[types field="yourfieldslug"][/types]
<br />
[/wpv-conditional]
...other stuff after your field
Let me know if I've guessed incorrectly about how your code is set up. If possible, please show me a screenshot of the special title field shortcode, and how it's placed in the wp-admin area.
More about conditional HTML here:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-fields-and-other-elements-for-emptynon-empty-values/
I'm still having some trouble with the output. It's putting extra <br> tags even when there is no content to output and I've used the conditional in multiple areas. Example: Greg Vandertop has no professional accreditations so I've left that field blank. I added the conditional html and now I'm getting 3 <br> tags after his email address.
Similar for the button. For the first 3 entries, it's added an extra <br> tag even though the rest are not.
hidden link
Hi, it might be easiest for me to take a look in your wp-admin area to recommend some changes. If that's okay with you, please provide login credentials in the private reply fields here.
Also, I don't know if you can help me with this but for staff members who are assigned to the category finance, I need those to display with a custom template header/navigation I've set up.
Okay I'd recommend creating a separate ticket for this, because it's a bit more complex than a one or two sentence answer. Let's investigate it separately please.
You can see the difference accounting page:
I think I have the line spacing on these two pages more consistent now, can you confirm? It had to do with the line breaks and conditionals.
Where I can't figure it out is for the single view of the finance staff, how can I assign it to a custom page template?
In the Content Template dashboard, you can see that the "Staff Members (single)" Content Template is assigned to all Staff Member single posts. If you want to modify that for specific posts, you can either:
- Set a different Content Template in each individual Staff Member's post editor (top right corner of the editor screen)
- Force a specific Content Template with some custom code utilizing the wpv_filter_force_template filter API. More information here -https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_force_template
The display is definitely better but there is still differences in the buttons. Please see the attached image for reference.
Different issue here, because the button code is rendered completely by Beaver Builder and we don't have the ability to place conditional HTML inside the button output. Another ticket includes a response from Beda that describes the problem:
https://toolset.com/forums/topic/content-template-adding-extra-p-and-br-tags-with-beaver-builder/#post-540027
As a workaround, please try adding the following code to both pages using the "Body Scripts" field in the page editor:
jQuery(document).ready(function(){
jQuery('.fl-button br:first-child').each(function(index, item) {
jQuery(item).slideUp();
});
});