Skip Navigation

[Gelöst] View loop style

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:
The customer asked how can the same post view be used to show different post types, in different content templates.

Solution:
Guided that you'll need to use separate post views in those content templates.

Relevant Documentation:
n/a

This support ticket is created vor 2 Jahren, 9 Monaten. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Dieses Thema enthält 10 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von leilaG vor 2 Jahren, 9 Monaten.

Assistiert von: Waqar.

Author
Artikel
#2293359

Hello, I am creating a view and have selected the Grid style but it does not change it on the front-end. Its stays as an ordered list.

#2293543

I have 2 content templates that have views, one was duplicated and used for a different post type.
Now both post types are pulling through data from each other, and I am unsure why.
They are not assigned to anything, following instructions from here - https://toolset.com/forums/topic/avada-theme-and-builder/

versteckter Link
Content template - versteckter Link

versteckter Link
Content template - versteckter Link

#2293683

Hi,

Thank you for contacting us and I'd be happy to assist.

I noticed that you've used separate content templates to create the views used on these pages. However, these views are shown on the pages using the view's shortcode and not through the content template shortcode, as Nigel recommended.
( ref: https://toolset.com/forums/topic/avada-theme-and-builder/#post-2292015 )

If you'll use the 'wpv-post-body' shortcode to load these content templates on those pages, the view's styles won't be lost.

Note: You won't be able to show view's search form and the search results in separate columns on the page if you'll load the content template as a whole. But, you can overcome this limitation, by editing the views so that the search form and the results are in two columns side-by-side:
https://toolset.com/course-lesson/creating-a-custom-search/#display-the-search-box-and-search-results-side-by-side

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#2293969

Hi Waqar, thanks for the info. I have fixed the shortcode and the grid layout, but the data is still being mixed up between the two content templates. How do I fix that?

#2295371

Is there a setting that I am missing?

versteckter Link Is not pulling through the correct search filters from its content template.
versteckter Link
It's also not displaying in its columns and is pulling through data from another post type.

The same with the below -
versteckter Link
versteckter Link

Also when I change the loop style in one content template, it changes it in the other content template. How do I have a different loop style in each content template?

#2295559

I've checked these pages and noticed that they are using separate content templates, but the view used on both these templates is the same view named "Companies".

You can keep this view for the template "companies", but in the template 'jobs' you can remove the current view block and instead add a new view block and create a new view named 'Jobs'.

This way you'll be able to control the loop and design on both pages, independently.

#2295595

Okay, I am seeing this error message when I try to create a new view 'Jobs:
Another View (Companies) already uses this slug. Please use another name.
Where can I edit the view name and slug?

'Jobs' was the original template that I duplicated to make 'Companies'

Does this mean if I want to copy a content template, and create something similar for another post type I need to create the view block from scratch?

#2296615

When working with the blocks based views, you can change their name but not the slugs.
( example screenshot for the view's name field: versteckter Link )

To avoid confusion and overlapping, you can use descriptive names for the views and content templates, for example:

Content templates:
( example screenshot for the content template's name field: versteckter Link )
- CT for Jobs Page
- CT for Companies Page

Views:
- View for Jobs Page
- View for Companies Page

Your understanding is correct and if you copy a content template, but want to show a different post type through the view, then a new view will need to be created from the scratch.

#2296735

Okay thanks for the explanation.

How do I delete views?

I noticed if I select an existing view it gives me the option to edit a copy of it. So is that the way to copy a view and use it for a different post type? and where can you edit which post type is being used?

#2298317

Please go to WP Admin -> Toolset -> Settings -> General and for the "Editing experience" select "Show both the legacy and Blocks interface and let me choose which to use for each item I build".

After that, the "Views" menu option will become available at WP Admin -> Toolset -> Views.

From this management screen, you'll be able to see all the available views and delete the ones that are no longer needed.

After creating the copy of a view, you can change the selected post type from the view's "Content Selection" settings.
( screenshot: versteckter Link )

#2299057

My issue is resolved now. Thank you!