Skip Navigation

[Resuelto] Linking to Page of Child Posts from Parent

This support ticket is created hace 8 años, 5 meses. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Etiquetado: 

This topic contains 6 respuestas, has 2 mensajes.

Last updated by Sean hace 8 años, 5 meses.

Assisted by: Beda.

Autor
Mensajes
#348935

I have a list of parent posts. Beneath them I've listed the number of children that each one has. I want to link to a page that has all of that posts' children listed. I know how to show the posts on the parent page, but how to link to ANOTHER PAGE that has everything beneath it alludes me.
Just to clarify further: I don't want all of these to be on the content template for the parent. This is a special backend for admins and editors.

So, visually:

Page One:
Parent Post One Title
-Two Children (just a tally)

Parent Post Two Title
-Three Children (just a tally)

That child tally links to:

Page Two:
Page One Name
-Child One Name
-Child Two Name
---

Should I be passing a variable in here somewhere? Or am I missing something obvious?

#349017

Thank you for contacting us here in the Support Forum and for providing the Debug Informations

1. "This is a special backend for admins and editors."

Toolset doesn't allow to design or create specific backend admins.

I assume you created a Front End solution that you use as a Admin area, correct?

2. To Display Child Posts in a List of Parent Posts, and any information linked to this Child Posts, such as link to etc, you can use 2 Views:

- Parent View lists all Parent Posts
- Child View, lists all Child Posts, who's parent is set by the parent View
- This Child View is inserted into your Parent View

3. What you need, if I understand it correctly, is sort of a Archive of Children's (a list of Posts, that are child of [...])

By Click on (in parent View) "Two Children (just a tally)", you would be lead to the respective list of Child Posts.

This can be done with a View that lists all your Child Posts.
A query Filter is set to:

Select posts that are children of the Post with ID set by the URL parameter wpv-pr-child-of.
eg. <em><u>hidden link</u></em>

This View is inserted to any page of your desire.

In your original Parent View you insert a Link like the below to the Loop:

<a href="<em><u>hidden link</u></em>">Text here</a>

This will lead you to the Page where you inert the View with URL argument, and always pass the correct Post ID as URL argument.
https://toolset.com/documentation/user-guides/passing-arguments-to-views/

Please let me know if you need further infos about this.

Thank you for your patience.

#349279

Excellent. Looks like I was only missing #3. I didn't know how to link to the page in question.

The only thing I seem to be missing now is how to properly show the parent title on this new page. If I put it within the loop, I get it for as many times as the loop runs. If I put it outside the loop, it doesn't know what the parent is. Do I need to wrap it in something? Or am I missing some option that let's me limit things within the loop?

#349676

I apologize the delay here

1. The only thing I seem to be missing now is how to properly show the parent title on this new page.

Do you mean, to show the parent title on the page that has always the URL
"hidden link;"?

There you display Posts that are Child of the Post passed in the URL.
It will output all those Posts, therefore the parent Post of those Posts is to be called in the Loop of the View.

And it will of course display as many times there is a Child Post.
You can call it with something similar to this:
[php]
[wpv-post-title id="$parent_post_type_slug"]

2. If I put it within the loop, I get it for as many times as the loop runs

This is expected. You have x numbers of Child (of in URL passed post) to output.
If there is only one such Post, it should display just once. If there are many, it will display as many times as there are Child Posts for the Parent passed in the URL.

Please let me know if you need further infos about this, or if I misunderstood the issue.

Thank you for your patience.

#351751
Screen Shot 2015-12-04 at 4.16.21 PM.png

1) Yes, I do mean the parent title for the page with the passed variable in the URL.
That's the format I'm using.

2) But how can I get it to only display once? I have no need for it to appear multiple times. Currently it looks like the attached image. That's not optimal. Is there a way to limit it to the first returned result? Or a way to get it to return the correct result outside of the loop?
It's supposed to be a page that shows you the title of the position you just clicked on, then all the people that applied for it. Feels like it should be pretty straightforward.

#351834

In your View where you display the Posts (by URL Parameter), please try this sort of Loop:

<wpv-loop>
 [wpv-item index=1]
  The parent of all currently displayed posts:[wpv-post-link id="$page"]
  The Child Post:
    [wpv-post-link]
    [wpv-item index=other]
    [wpv-post-link]
</wpv-loop>

We are using the wpv-item ShortCode here.
More infos can be found here:
https://toolset.com/documentation/views-shortcodes/#wpv-item

Please let me know if the above solution works for you, I look forward to your reply!

Thank you for your patience.

#352145

That worked, thanks. I had never used the index attribute before. Quite useful.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.