Hope the solution is already there and I just messed with terms etc…
I want to create a template view for a list of posts that so can use in several views as each view is needed in certain places on my site to select a certain set of posts.
In order to have the styling in one place for displaying each of the lists, I wonder if there is such thing as a template )or how to apply it).
Example: on one page I select posts of a certain tag, on another of a certain category. I also need a list of posts under a CPT for brands so that I can display a post list for a brand that are related to the brand. Or a last example: I have a CPT events and want to display a list ot posts that are related to an event…
So, how can au define the styling of a post list in one place while using it his “template” in each view that I create to achieve the tasks above?
Hello. Thank you for contacting the Toolset support.
If you want different styling which includes different HTML per tags or category you will have to create different templates for that but if your case is that you build one content template and you want to reuse the same again for the tags, categories then you can reuse it.
if I get it right – applying a template to a post conditionally is more to enable different templates to one post.
But what I am looking for is to us different views in different templates that produce always a list of post (but with different selection criteria). And I want to design this list of posts as part of a template/page just once and re-use the design in the different views.
Yes - but it will be more broader concept until and unless you share your specific requirement.
You can design content template having a view inside it but if you want to filter it with different terms and reuse the view then you will have to use the classic view.
For example - you create a view list posts and filter with different category that means you are using the same view but filtering it with different category:
- Is the example shared above is related to your requirement or you still want something else.
If you can share problem URL and admin access details and tell me your goal with details what exactly you want to achieve that will help me to guide you in the right direction.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
the hint to the shortcode options for a view is fine good as I will be able to use theses in some cases. But in others a parameter is "missing". For narrowing down e.g. to categories ist works already. But I use the block editor to create views as I need to select them by some criteria.
See here: versteckter Link
at the end there is a list of posts ( not very stylish so far...). On other pages I use completed different criteras, but again it prodices a list of posts...
Any idea if this is possible so that I do not have to style the "View Loop" so that the list of posts looks the same as in another template`
If you want to reuse the content you put within the view's loop, you will have to create a content template in classic mode namely for example "reusable-template-view-loop" and add whatever content you want to display to that content template and then add that content template within the different view's loop.
currently, I switched nearly all work to the block editor. Do I get it right that there is no way to achieve this with the block editor? Only with the classic editor?
Or can I create a view in the block editor and use its name in the classical editor just inside the template and name it there?
Its great that all seems to work. With block editor you might get a issue with styling and all when other blocks are involved. That is why I suggest you to use the classic editor but if it works all fine as expected even with blocks then there is no harm using it. Using classic editor it will offer you more flexibility to edit your HTML and content compare to block editor.