I need to display images of a PDF with the URL of the pdf, but I need to replace the '.pdf' ending with '-pdf.jpg'
The shortcode I have for the PDF is [wpv-post-url] inside my Toolset View. Do you know how I can edit the output URL to change the ending as described above?
I tried using a plugin to accomplish the same thing but had issues with it, so any help you could provide is gretly appreciated.
Hello. Thank you for contacting the Toolset support.
You will have to write the custom shortcode that replace the last 4 characters of your URL to the characters you want.
Can you please share problem URL and admin access details and tell me with what field you want to replace the characters?
*** 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.
The fatal error on the site is logging the following error:
[24-Sep-2021 06:56:33 UTC] PHP Fatal error: Cannot redeclare convert_date_fields_func() (previously declared in /home/pdccpanel/public_html/wp-content/toolset-customizations/convert-jci-hp-date.php:12) in /home/pdccpanel/public_html/wp-content/toolset-customizations/cutom-pdf-url.php on line 22
It seems that the [wpv-post-url] for these media items is loading the post URL which is different than the File URL that the post URL redirects to on click.
What we need to edit is actually the file URL that the items redirect to. Do you know if there is a field shortcode that loads that?
I've made a duplicate of the View called 'Research and Reports - Duplicate for testing' so we can make changes without affecting the frontend as the site is currently under review.
Thank you for your help!
I see you are using the PDF thumbnail plugin and the redirection happened to PDF thumbnail due to that. You will require to check with the plugin support about how you can display the PDF thumbnail within the view's loop.
Yes, this code would be to replace the Thumbnail plugin as I found some issues with it.
In this page I inserted the duplicate of the View so we can make changes: hidden link
The thumbnail was being displayed because the View Template is using this as the SRC URL: [wpv-post-featured-image size="full" output="url"], ideally we'd replace that shortcode with one that takes the URL of the PDF and changed the .pdf ending.
My apologies If I didn't understand you correctly.
I do not see anything with the test URL you shared:
=> hidden link
In addition to that, I tried changing image URL from jpg to pdf:
=> hidden link
To:
=> hidden link
but it does not load any PDF file. As you already aware that Toolset does not offer any feature related to PDF and what function you are assuming that chafing the image url from .jpg to .pfd is not actually working.
That's likely because of the Custom Code that was added to Toolset for filtering the View Items referencing the original view ID, so duplicating the View may mean that the custom code needs to be edited?
Aplogies if I caused confusion.
To help clarify, we are not trying to edit the .jpg ending of the attached thumbnails to .pdf, we are trying to change the .pdf extension of the PDF to '-pdf.jpg'
So for the images above, you'll see the actual PDF media item is at: hidden link
and we want to edit the URL ending to the following: hidden link
Both the links above should be working right now, and this would remove the dependence we currently have on the PDF Thumbnails plugin.
Thank you for your patience and all your help, you've been wonderful!