Passer la navigation

[Résolu] CPT Arhive links not loading docs

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

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Fuseau horaire du supporter : America/Jamaica (GMT-05:00)

Ce sujet contient 5 réponses, a 2 voix.

Dernière mise à jour par Shane Il y a 3 années et 5 mois.

Assisté par: Shane.

Auteur
Publications
#2270117

I have various CPT setup. The issue in question is found on various posts created. For this excersize we will be looking a the Supply Chain Doc CPT and more specifically the post category " Supplier Database Verification " which loads one post called "GM Supplier Verification Form 2021". I am experiencing a issue where the "download" button is not loading the PDF file but rather the actual category again.

lien caché

#2270503

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Fleur,

This should now be working. The issue was that you were using the incorrect slug for the custom field that you want to retrieve the URL from.

The correct field should be [types field='document-supply-chain' output='raw'][/types]

Please let me know if this helps.
Thanks,
shane

#2271037

Thanks, experiencing the same issue on the below taxonomies, but fields seem correct:

lien caché
lien caché
lien caché
lien caché
lien caché

#2271313

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Fleur,

Some of the fields are still incorrect. For e.g here

<div style="display: block; background: #f5f5f5; padding: 5px 10px;">
  <div style="display: inline-block; width: 80%;">[wpv-post-title]</div>
  <div style="display: inline-block;"><a class="dwnload" title="download" href="[wpv-post-url]" rel="noopener">View</a></div>
</div>

This is for your 3rd conditional to view a document but you have the [wpv-post-url] set as the link to view. Is it a case here you want to view the post or a document attached to the post.

As you can see the link below archive is working perfectly fine.
lien caché

The download links are going to the PDF files that are attached.

I do notice that on some of your posts that you have an additional download field that was not created using types called document. Here is an example.
lien caché

This post has no value in the upload field but it has the default wordpress custom field.

In such a case you will need to check if our types field is empty and decide what you want to display. Here is an example

<div style="display: block; background: #f5f5f5; padding: 5px 10px;">
  <div style="display: inline-block; width: 80%;"><a style="display: block; ;font-size: 14px;" title="download" href="[types field='document-supply-chain' output='raw'][/types]" target="blank" rel="noopener">[wpv-post-title]</a></div>
[wpv-conditional if="('[types field='document-supply-chain' output='raw'][/types]' ne '' "]
  <div style="display: inline-block;"><a class="dwnload" title="download" href="[types field='document-supply-chain' output='raw'][/types]" target="blank" rel="noopener">Download</a></div>
[/wpv-conditional]
[wpv-conditional if="('[types field='document-supply-chain' output='raw'][/types]' eq '' "]
  <div style="display: inline-block;"><a class="dwnload" title="download" href="[wpv-post-field name='document']" target="blank" rel="noopener">Download</a></div>
[/wpv-conditional]
</div>

Please note the use of [wpv-post-field name='document'] shortcode to get values of custom fields that were not created with Types.

I would suggest that you go through and make these changes to ensure that you're covering the various fields that you have. Also I do notice that even on the same archive some posts have the document stored in the Types field and some have it stored in the Document default field, this is why some posts do not have their documents attached.

Thanks,
Shane

#2271343
Screenshot 2022-01-20 at 16.46.37.png

Why aree all my archive llisting displaying duplicate ? Ihavent changed anything?

#2271401

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

HI Fleur,

This was added in order to differentiate the different conditional statement that was being used as well as to provide a link to the post where I can view the edit screen to check the fields.

I've since removed this and the items should be displaying as intended.

Thanks,
Shane