Skip Navigation

[Résolu] empty parent post on child – showing page title

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.

Marqué : 

This topic contains 5 réponses, has 3 voix.

Last updated by adamP Il y a 5 années et 4 mois.

Assigned support staff: Adriano.

Auteur
Publications
#373620

We have a child post with a post link to parent.
1. When we choose -No Parent- why does the current post title show. vs show nothing.

2. We have tried many ways using conditionals to hide title/ show value and none are working.
We want the company parent to show if a value is chosen and if no value show blank or "Not Linked"

test 1 Awarded To:
[wpv-conditional if="( $(_wpcf_belongs_company_id) eq '-1' )"]Not Linked[/wpv-conditional]<br>

test 2 Awarded To :
[wpv-conditional if="( '$(_wpcf_belongs_company_id)')"][wpv-post-link id="$company"][/wpv-conditional]
[wpv-conditional if="((empty($(_wpcf_belongs_company_id))))"]Not linked[/wpv-conditional]

test 3 Awarded To :
[wpv-conditional if="( '$(_wpcf_belongs_company_id)')"][wpv-post-link id="$company"][/wpv-conditional]
[wpv-conditional if="( $(_wpcf_belongs_company_id) eq '-1' )"]Not Linked[/wpv-conditional]

test 4 Awarded :
[wpv-conditional if="(NOT(empty($(_wpcf_belongs_company_id))))"]
[wpv-post-link id="$company"]
[/wpv-conditional]

#374056

Hello,

1. I didn't get this. Isn't it showing the right parent title?

2. Unfortunately you can't use wpv-conditional to compare data from the parent, I've forwarded this to our development team and they should implement this in the future. Meanwhile the only way should be by creating a View with a post relationship filter related to the current post, then you can display something if posts were found and a different thing when posts were not found.

#374131

I tried your suggestion and get the same results that the child shows the childs title and not blank.

so currently out of the box
1. child shows the parent value when a parent is selected from the list on the child.
2. If no parent is selected and we use default option of "- No Parent-" then it displays the child "title" vs should be blank.
3. In the database the value when No Parent used , it is saved as "-1"

So what we were trying to do is hide child title and display "No Link" if there was no value ie. " -No Parent-" selected.

#374343

Please share credentials and I'll try to craft something for you.

#378416

I am having this same issue. Was there as resolution?

#378417

Just tried this, and it works well. If it's a help to anyone.
Since an empty parent just displays the title of the child, I used a condition to see if the parent-title=child-title, if so, then output some text. If not, then display the real parent-title.

[wpv-conditional if="( '[wpv-post-title id="$unit"]' eq '[wpv-post-title]' )"]Tenant is not applied to any Unit[/wpv-conditional][wpv-conditional if="( '[wpv-post-title id="$unit"]' ne '[wpv-post-title]' )"][wpv-post-link id="$unit"][/wpv-conditional]