Skip Navigation

[Resolved] Displaying a Parent Post Content Template in a Child Post

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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 9 replies, has 2 voices.

Last updated by davelow 1 year, 9 months ago.

Assisted by: Minesh.

Author
Posts
#2568921

Tell us what you are trying to do?

I called a Toolset View (built using blocks editor) in an elementor page using shortcode, but i couldn't the have view layout in columns/grids like it was built. (it was changed to one column). I found in support forums someone previously had the same issue and tried the solution of creating a content template with a similarly constructed view.

Site structure is as such:
"Breeds" post type has 'one to many' post relationship to "The Pack"

Currently on "the Pack" single post, I call the content template with the following shortcode:

[wpv-post-body id="[wpv-post-id item='@breed.parent']" view_template="#Siblings"]

The content template "Siblings" is constructed with reference to:
https://toolset.com/documentation/legacy-features/views-plugin/displaying-brother-pages/

I am able to identify that id="[wpv-post-id item='@breed.parent']" returned a correct post-id,
but am still not achieving the desired result on the single page.

Is there any documentation that you are following?

https://toolset.com/forums/topic/shortcode-and-view-layout/
https://toolset.com/documentation/legacy-features/views-plugin/displaying-brother-pages/

Is there a similar example that we can see?

What is the link to your site?

#2569081

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please share problem URL and admin access details and also mention what is your expected output and I will review your current setup and 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 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 have set the next reply to private which means only you and I have access to it.

#2569265

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Unfortunately - the admin access details you send to me is not working at this end. Can you please send me working admin access details.

Also, you want to list the dosts belongs to same breed and same birth-date based on the current post? or to what field we will require to compare the breed and birth-date?

I have set the next reply to private which means only you and I have access to it.

#2570225

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

With what view you want to display the dogs?

or you want to display any other post type?

As with the view "Same Breed and Birthdate" on the following page the post type assigned to this view is "The Pack":
=> hidden link

Do you want to display dos posts or "the pack" posts and to what section as I can see you added multiple views to your Elementor single content template:
=> hidden link

I will require bit more accurate details about from what post type you want to display what and with what view and view is added to what section of your elementor template.

#2570283

Hi Minesh,

The view is working as intended. The problem with using the view is that the output is in one column even though it is constructed to have a few columns in blocks. the four columns now is achieved via elementor, and i cannot get them to align. (we can't really tell with one row, but it will become obvious if the view has enough results to make 2 or more rows) The present solution also shows text in four columns if no results are found. (see hidden link)
The following works, but the output is always one column - [wpv-view name="Same Breed and Birthdate" wpvrelatedto="[wpv-post-id item='@breed.parent']" birthdate="[types field='date-of-birth' output='raw'][/types]"]

That is why I am testing to use a content template so call the view. but in using a content template, I can only pass one argument (breed). I am looking for a solution to pass date of birth to the view in the content template, but have not found a workaround.
The following is what I am testing - [wpv-post-body id="[wpv-post-id item='@breed.parent']" view_template="#Siblings"]

as for these 2 lines -

id="[wpv-post-id item='@breed.parent']" - I had this line here to see wether I got the correct parent post.

birthdate="[types field='date-of-birth' output='raw'][/types]"] - I was trying to pass "date of birth" to a content template, but i can't.

I hope this clarifies.

#2570353

Hi Minesh,

I've setup the page (hidden link) to reflect the first problem i faced.
The View called by shortcode

[wpv-view name="Same Breed and Birthdate" wpvrelatedto="[wpv-post-id item='@breed.parent']" birthdate="[types field='date-of-birth' output='raw'][/types]"]

outputs the intended results, but the results are unformatted even though its loop style and grid settings are configured (please see the 2nd view at hidden link)

Is there anyway I can use block editor and achieve a formatted loopstyle and grid settings here?

==================

The above issue led me to attempt to use a content template so that the output is formatted correctly.
But in using a content template, I am only able to pass one variable (which is breed.parent). I need to pass a second variable like i did in Views above, so that I can run 2 filters in the View residing in the content template. How can I achieve this?

#2572129

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

On the content template where you added your view:
- hidden link

On 2nd view I've added the following custom CSS to Custom CSS section of your 2nd view:

.js-wpv-loop-wrapper > .tb-grid {
    grid-template-columns: minmax(0, 0.20fr) minmax(0, 0.20fr) minmax(0, 0.20fr) minmax(0, 0.20fr) minmax(0, 0.20fr);
    grid-auto-flow: row;
}

Can you please confirm it works as expected?

#2572447

Thanks Minesh,

The output is as expected now.
I have tidied up the backend to call the view with parameters directly instead of through a content template.
I have also turned off the debug mode.

I just to verify that some view settings cannot be passed when a view is called via a shortcode with extra parameters? and because of this, you have employed CSS to specify the grid settings of the view.

#2572489

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

No - it seems its due to conflict between elementor grid CSS and blocks CSS.

Glad to know that solution I shared help you to resolve your issue. You are welcome to mark resolve this ticket.

#2572515

Exemplary support from Minesh.
My issue is resolved now. Thank you!