The Better Way to Display PDFs in WordPress

Поделиться
HTML-код
  • Опубликовано: 24 янв 2025

Комментарии • 22

  • @slypandadesign
    @slypandadesign 2 месяца назад +1

    Thanks Josh! Another timely tutorial. I have a client who wants to display PDFs of each the magazine articles they've been featured in. Something like this offers the perfect solution. Thanks again!

    • @yourthemeco
      @yourthemeco  2 месяца назад +1

      Fantastic, let us know how it goes!

  • @staceymarler7746
    @staceymarler7746 Месяц назад +1

    I appreciate you making this video based on my suggestion from the prior video! I had an issue showing the title and using the url link when using repeaters with an array output. I finally figured it out via the {{ looper.field({"key":"ACFFieldName.title"}) }}. The ".title" and ".url" after the field name to pull in the appropriate meta info was making me go crazy trying to get it figured out. I found the how-to from a prior looper video you guys created. Great videos recently, and keep them coming!

    • @yourthemeco
      @yourthemeco  Месяц назад +1

      Very glad you found the video helpful. You can sometimes change the ACF output to be just a URL or title, but if you want to display both those data points using dot notation to grab object data can be the way to get data you have referenced. Cheers!

  • @Schauk
    @Schauk 2 месяца назад +1

    Wow, this is incredibly helpful! Thanks for teaching us, Josh!

  • @tomuch4078
    @tomuch4078 2 месяца назад +1

    So good! I’m so excited to utilize this on my site!!

    • @yourthemeco
      @yourthemeco  2 месяца назад +1

      Awesome, it's a great quality of life improvement for PDFs.

  • @EdgardMello
    @EdgardMello 2 месяца назад +1

    Hi Josh! Thanks again for the great content. How can I show only PDFs related to the logged-in user? Is it possible?

    • @yourthemeco
      @yourthemeco  2 месяца назад

      Currently you can't loop over attachments in our Query Builder. The problem being you can't select the attachment post type and we don't have controls over the post status. You could either use the query string (keeping in mind the post status issue alluded to earlier) and filter by the attachment author or setup a User Meta field in ACF that you could add multiple attachments to a user. Have a great day.

  • @henrybagilhole5154
    @henrybagilhole5154 2 месяца назад +1

    Great Tutorial Josh, I've just gone thorugh the same thing but didn't like the PDF Emebedder styling so I've had to revert my client having to use the Wordpress File Block for PDFs which has a much nicer interface (it also works with Interactive PDFs). Do we think there is a way of showing the built in wordpress block in similar way? Hope that makes sense.

    • @yourthemeco
      @yourthemeco  2 месяца назад +2

      Internally, WordPress uses the tag to display a PDF. Using the same Dynamic Content in the video you would paste something like this in a Raw Content Element, where data is the file URL. Have a great day.

  • @chrisk9667
    @chrisk9667 Месяц назад +1

    Thanks Josh. Is it possible that from the list of pdfs on the archive layout that rather then going to their individual document page that they just open the pdf in the browser? They can still download from there and my client prefers to open it straight away as opposed to seeing another page. :)

    • @yourthemeco
      @yourthemeco  Месяц назад +2

      Sure thing! You could always link out to the PDF directly if it's hosted on the site and take the link directly to that URL. If I'm understanding you correctly.

  • @linnmarketing
    @linnmarketing 2 месяца назад +1

    Great - as always. Thank you Josh! Would have saved me a lot of trial and error, if I had seen this a year ago ;-) The only thing missing here is how to show a pdf's thumbnail on the archive page.

    • @bill-hodgson
      @bill-hodgson 2 месяца назад +1

      You'll need to make one - I haven't found something that would make that happen. Add it as the featured image, use a screenshot of the first page for instance.

    • @yourthemeco
      @yourthemeco  2 месяца назад +1

      Hey Uli, I don't think any of the 3rd party PDF tools would support something like that, but it would be very easy to do in Cornerstone as Bill suggested.

    • @linnmarketing
      @linnmarketing 2 месяца назад

      @@bill-hodgson As manually creating screenshots is no option, in one case I used the "PDF Thumbnail Generator" plugin. It creates a thumbnail for every uploaded pdf, the thumbnail's filename is the original pdf-filename + ".jpg", so it can be shown by something like . I hoped there would be some native WP / Cornerstone way to do it without needing another plugin.