[Résolu] get a global variable for all views on one page
Ce fil est résolu. Voici une description du problème et la solution proposée.
Problem:
How to filter view by child post by taxonomy term using shortcode attribute and display it with different layout's visual editor cells
Solution:
To filter your child posts by category, you can use view's shortcode argument so you can use same view to filter multiple category and display it with different layout section.
This support ticket is created Il y a 6 années et 11 mois. 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.
Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.
I have two custom post types: one is a journal and the other is a child of this journal that contains articles.
For every journal there is a page with a lot of views with articles from that journal, most of them based on categories.
So a view with headlines, a view with recomended etc...
In order to get the carticles that belong to a cetain journal I think I have to create nested views.
But now I wonder because I have to make a nested view for every one if there is an easier solution where I can store the Id of the parent Journal of that page and use that global variable for all the child views on that same page (layout).
I hope you understand the situation. Please let me know if there is such a solution or what else is the best way to create the child views.
Sorry, I should be more clear here.
My question does not relate to the parent main page. Because then it is easy; I can set the filter to "childres of the current post in the loop".
In my case, it is not the parent Journal page, but a kind of landingpage with information from the latest journal and articles from that latest journal.
Hello. Thank you for contacting the Toolset support.
Well - I can better help you if you give me test case example with all required information and what will be your exact output to guide you in right direction.
Have you build parent child relationship with your custom post type using Types relationship?
Yes, I have created the parent and child post types.
Have a look at this image:
lien caché
A - holds the title and image from the latest parent post type
1, 2 & 3 - are views. These are all articles (child posts from the parent post) filtered by a different category.
How can I create those (child) views without building a parent view for all three of them.
Is it possible to retreive the parent post id once and pass it on use it on to all three child views (by shortcode attribute for example)?
No this is not the parent post single page (have a look at my second comment above: reply #597622)
This page not related to the parent post single page.
It is a special page (landingpage for members) with different kind information, and among that the latest edition of the journal with different lists of child articles from that latest journal.
As I understand with this special landing page you want to display "latest journal" (only one post which is parent) and its associated categorized articles (childs) - correct?
so whats the definition of "latest journal"? is it the most latest parent post added?
Now, I would like to know how you display latest parent post information within layout? using what shortcode? Are you using view's to fetch latest parent post?
I'm understanding here you are using view's to fetch single latest parent post.
Ok - so the best way is to use view to fetch parent latest post.
Now, to filter your child posts by category, you can use view's shortcode argument so you can use same view to filter multiple category and display it with different layout section.
If you are not sure how to do it, you should just create view to fetch your parent post and display the parent information on layout and pass me the access details with problem URL where you would like to display the child posts articles.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) 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 would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).
I have set the next reply to private which means only you and I have access to it.
- You can change the "overzichtsartikel" as per your desired taxonomy term slug.
One child view:
=> lien caché
Where:
- Child view is setup to filter by:
Taxonomy filter
Select posts with taxonomy:
Rubrics slug in one of those set by the View shortcode attribute term
eg. [wpv-view name="view-name" term="xxxx"]
And
Post relationship filter
Select posts that are a children of the current post in the loop.
So, as you can see - with section "headlines" - we are displaying articles which belongs to term "overzichtsartikel" and with section "headlines1" we are displaying articles belongs to term "casuistiek".
I hope above solution help you to resolve your issue. 🙂