Skip Navigation

[Résolu] Parent CPT fields are no longer showing up in child view

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:

The [wpv-conditional] shortcode does not work as expected in a taxonomy archive page. See the details here:

https://toolset.com/forums/topic/parent-cpt-fields-are-no-longer-showing-up-in-child-view/#post-955683

Solution:

This should be an exception, those codes you mentioned above does not work in the wordpress archive of client, currently, there is a workaround, you can use a content template to display those codes, for example:

https://toolset.com/forums/topic/parent-cpt-fields-are-no-longer-showing-up-in-child-view/#post-1071295

Relevant Documentation:

This support ticket is created Il y a 5 années et 9 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.

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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

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

Last updated by James Thompson Il y a 5 années et 8 mois.

Assisted by: Luo Yang.

Auteur
Publications
#955683

The following code has worked properly until a recent update:

<wpv-loop>
[types field='featured-lot-image' size='medium' align='left' resize='proportional'][/types]

<div class="feat-lot-desc">
[wpv-conditional if="( $(wpcf-hammerunitprice) eq '' )" evaluate="false"]<b>Sold Price: $[types field='hammerunitprice' format='FIELD_VALUE'][/types]</b>[/wpv-conditional]<br>
[wpv-conditional if="( $(wpcf-lotnum) eq '' )" evaluate="false"]LOT [types field='lotnum'][/types].[/wpv-conditional] [types field='description'][/types]
[wpv-conditional if="( $(wpcf-presaleestmin) eq '' )" evaluate="false"]<br>Estimate: $[types field='presaleestmin' format='FIELD_VALUE'][/types]-[types field='presaleestmax' format='FIELD_VALUE'][/types]<br>[/wpv-conditional]
Auction: <a href="[wpv-post-url id='$auction']">[types field='auction-title'][/types], [types field='auction-date' style='text' format='F j, Y'][/types]</a>
</div>
</wpv-loop>

Here is the view:
hidden link
Recent Post Sale Highlights.
The CPT is 'featured lots' and the parent cpt is the 'auction' - The link works (using the comma which is only visible content within the a href at this time) - the auction name, and date had always worked. It no longer works. What have you changed? and How do I resolve this?

#955684

This also no longer works on my archive page:

[wpv-conditional if="( $(wpcf-auction-title).id(auction) eq '' )" evaluate="false"]<p>Auction: <a href="[wpv-post-url id='$auction']">[types field="auction-title" id="$auction"][/types], [types field="auction-date" id="$auction"][/types]</a><br>[/wpv-conditional]

archive page used to display auction & date:
hidden link

#955719

Most issues are resolved with all toolset plugins being updated - however now, the conditional statement that usually works with parent fields is not working.. for example:

[wpv-conditional if="( $(wpcf-auction-title).id(auction) eq '' )" evaluate="false"]<p>Auction: <a href="[wpv-post-url id='$auction']">[types field='auction-title' id='$auction'][/types], [types field='auction-date' style='text' format='F j, Y' id='$auction'][/types]</a>[/wpv-conditional]

The above should show the Auction title and date if the child CPT is associated with an auction, and show nothing if there is NO auction associated with the featured lot. This is not working, have tried several solutions.

#956356

Minesh
Supporter

Languages: Anglais (English )

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

Hello. Thank you for contacting the Toolset support.

Well - I need to know what is your current setup, what Tooslet plugins you are using.

Could you please send me debug information that will help us to investigate your issue.
=> https://toolset.com/faq/provide-debug-information-faster-support/

#957013

As I mentioned - all toolset plugins are up to date. The code for conditional view should be correct. Makes no sense.

#957173

Minesh
Supporter

Languages: Anglais (English )

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

Doh, I wonder how I missed that.

Well - could you please share problem URL and access details where shortcodes are not working as expected?

*** 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.

#1069512
conditional.png

The following code works on the 'template' page for CPT 'Featured Lot'

[wpv-conditional if="( $(wpcf-auction-title).id(auction) eq '' )" evaluate="false"]<p>Auction: <a href="[wpv-post-url id='$auction']">[types field="auction-title" id="$auction"][/types], [types field='auction-date' style='text' format='F j, Y' id='$auction'][/types]</a><br>[/wpv-conditional]

Example
There is no Parent 'Auction' associated with this lot: hidden link
There is a Parent 'Auction' associated with this lot: hidden link

You see that one shows nothing in "Auction:.... " section, the other shows the auction the child featured lot is associated with.

THIS EXACT SAME CODE ABOVE DOES NOT WORK WITH:
Toolset > WordPress Archive > 'Archive for featured lots' - hidden link
or
View 'Featured lot slider - hidden link
- the result with the same condition code as above for these is that it shows nothing, regardless of if it has parent 'auction' associated with it or not. (therefore the code has been removed on my working live site)

I am not able to give you access to this clients live/website server - Surely you can test conditional display of parent CPT fields with your own test site/s? This is very disappointing for this to just stop working when it worked when it was developed, TOOLSET changed parent-child relationship details somewhere along the ver history, I corrected it as needed and still problematic.

#1070001

Minesh
Supporter

Languages: Anglais (English )

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

Ok - its fine if you not able to share access details to live site.

Is it possible for you to send me duplicator copy of your site - so I can check with your existing setup?

If thats not possible, I need following information:
- What is the relationship you have between two post type one to Many or many to many?
- have you migrated to new Relationship from Toolset => Relationship ? Please share screenshot of this page that would be great.

Just to make sure, so I can check once I get your confirmation with my local test install.

#1070399

hidden link

*** Please set this to private - I can not add this to previous private mssg nor set this one to private.

#1071256

Hello,

I was assigned to this ticket, as your request, I have edited your post, and remove the URLs.

And I can download the duplicator package, and is trying to duplicate the same problem, will feedback if there is anything found

#1071295

Thanks for the details, I can duplicate the problem with your duplicator package: Those codes you mentioned above does not work in the wordpress archive, I will escalate it, currently there is a workaround, you can use a content template to display those codes, for example:
1) Create a content template, for example "test-1", with the codes you mentioned above:

[wpv-conditional if="( $(wpcf-auction-title).id(auction) eq '' )" evaluate="false"]<p>Auction: <a href="[wpv-post-url id='$auction']">[types field="auction-title" id="$auction"][/types], [types field="auction-date" id="$auction"][/types]</a><br>[/wpv-conditional]

2) Put above content template shortcode into the wordpress archive:
hidden link
section "Loop Editor":

[wpv-post-body view_template="test-1"]

It works fine in my localhost with your duplicator package, can you have a try in your website?

#1072684

Ok, this is fine although unfortunate that a workaround is necessary - seems a glaring oversight in the big relationships update/s - I hope I will be notified when this is resolved. Thank you Luo.

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