I run training courses and am trying to build a single product template that incorporates three tabs within the layout to show "Who The Course is For", "What They Will Learn" and "What Is Included in the Course Fee". The latter two tabs are based solely on term meta and have been populated by Views created successfully using the Loop Wizard (using a Bootstrap grid with one column) without any further amendment. As I am new to Toolset, these were my first attempts at using the Views plugin so I was delighted with the results.
The "Who The Course Is For" tab content is slightly more complex comprising some conditional output (controlling plain text), the content of a post field (Target Role) and the output from a View created from term meta. The various elements need to come together to form a coherent sentence.
Initially, I set up the view within the Views plug in (see Loop Set Up without Conditional Content.png), as per the other two views which had worked successfully and then tried to build up the various elements within the Layout (see Layout Set Up (Tabs) with Conditional Content.png) using shortcodes. This produced the correct content for the tab but the conditonal output / post field derived content was on one line (see Front End Result.png - relevant items marked purple) and the term meta derived content created by the View (see Front End Result.png - relevant items marked red) was on another instead of being one sentence.
I wondered if the various <div> tags in the Loop Wizard were potentailly causing the problem so I copied the conditional output / post field shortcodes into the Loop Wizard (see Loop Set Up with Conditional Content.png) to where I thought they ought to go (immediately preceding the shortcode that seemed to produce the wizard derived Loop output. Again this produced the correct content for the tab but the conditonal output / post field derived content (see Front End Result.png - relevant items marked green) was still on one line and the term meta derived content (see Front End Result.png - relevant items marked red) was on another albeit closer together, instead of being one sentence.
I think I am almost there but am struggling to identify the cause of the two parts of the sentence appearing on separate lines and would appreicate some additional guidance as I envisage needing to build similar structures elsewhere on the website.
Many thanks
Dear Chris,
The various HTML <div> tags in the Views Loop should not cause the problem, if you setup them correctly.
I assume you are going to setup the Views Output as "Bootstrap grid" format, please check our document:
https://toolset.com/documentation/user-guides/view-layouts-101/#bootstrap
And I suggest you put those conditional codes into a content template, then put it into Views loop:
https://toolset.com/documentation/user-guides/using-a-view-template-in-a-view-layout/
To setup the conditional codes, please check our document:
Conditional HTML Output in Views
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
For your reference.
Thanks for the reply, I have looked at the three articles and had approached the problem in the way described apart from following the recommended approach of putting the conditional code in the content template for the view.
I have updated my site to remove my original attempts and change it so that the information now comes from the Content Template (see attached images - Loop Editor Updated.png & View Template Update.png) but the result is still split on separate lines when output (see Front End Result Updated.png).
Thanks
I assume we are talking about the line break before text "forthcoming wedding ...", which is just before the shortcode [types termmeta='who-attends'].
How do you setup the custom term field "who-attends"? could you take a screenshot for it? I need to duplicate same problem ,test and debug it in my localhost, thanks
You are correct the line break is the problem I am talking about.
Attached are the screen shots for the term field set up and the specific set up for the "Crafting" taxonomy entry.
Regards
Thanks for the detail, please edit the shortcode from [types termmeta='who-attends'] to:
[types termmeta='who-attends' output='raw']
More help:
https://toolset.com/documentation/customizing-sites-using-php/functions/#textarea
output:
'raw' | 'html' | 'normal'(default)
‘raw’=display raw data stored in DB, ‘html’=wrap data in HTML
Thanks that has worked perfectly.