WordPress: Can you add an Excerpt on a PDF - php

Is it possible to add an Excerpt on a PDF document. Whenever I use the search function on my website I can see the PDFs results, but the text below the link says "No excerpt available". I tried adding text into the Description and Caption fields, but it did not work.
I tried going through the media library > clicking the file > Edit more details then when the file document opens I clicked on the Share Options at the top of the page, but there is no Excerpt option available.
I can see the Excerpt option in Pages and Posts, but not on PDFs.
Is there a way to add Excerpts to PDF documents?
Thank you.

I do not know of any plugins nor native way to do it but I had a similar problem on one of my last projects and here are my solutions.
Either... Creating a child post dedicated to that pdf and copying the content, outputting the child post content onto the parent post.
Or... Simply adding a description to the uploaded media (here the pdf) and outputting the description onto the post.
I went for the second one for dev time restriction, but the first one was also pretty cool because we could add long format additional information linked to the pdf.
Hope that will help!

Related

Drupal 7: How can I link uploaded images (via an image field) to specific URLs contained in a text field?

I need to link individually uploaded images (via an image field) to different external URLs (e.g. Link one image in one post to a website outside of my own). I've found modules that allow me to link image fields to nodes within my drupal site, but nothing that allows me to link uploaded images individually to different urls. That said, I figured I could create a text field, input a URL there, and set my Image Field in views to be linked to the contents of that field. E.g. Destination: [field_link_image_to]
However that doesn't seem to be do-able either. Any suggestions as to how I can go about doing this?
Use Link field module (https://www.drupal.org/project/link). After enabling add this field to the same content which contains the image you want to link to specific URLs.
Create a view then include both image field and link field url (you will get the exact URL which you will enter into the link field) then add custom text and create your html accordingly.
Let me know if it works or you want something else.
Thanks.

Wordpress: make a post's video URL accessible from the loop

I'm looking for solution to a particular situation. In my theme each post is on a single page (single.php). Single page has a slider inside of the loop that is populated with attachment images. In that slider, I need to add some videos that are hosted on YouTube.
What I think I need is to write a plugin that allows to add YouTube URLs to a post in UI input fields in post editing window. These links would be then accessed using post id from single.php, so that I could loop through them, using foreach and render them as as html5 video.
I need a general advice on how this can be done. I've got a working slider that needs to host these videos along attachment images, but using attachment video does not work and it doesn't seem to be a viable solution (it's bandwidth intensive).
Any help is appreciated.
Thanks
I've sorted this out using a simpler approach, namely, I've used shortcodes to wrap content that's in the slider. It worked fine and saved plenty of time; it's more intuitive in comparison to using image attachments for creating the content, too.

Dynamic page thumbnails

I need a way to automatically generate a thumbnail of the target page when the user hover over a URL (hyperlink) on my page.
I've found several examples of people using pre-created .gifs (or other images) to show a thumbnail of the target site while hovering over the link (see example #1), but I need a way to do this dynamically. Is there a way to generate a thumbnail of a page, either on runtime, or an easy way to update the current thumbnail after editing a page?
Simply put; I need to show a thumbnail of the target page when hovering a hyperlink on my page. This thumbnail should not be based on an image that I have to generate myself after each edit, but rather a snapshot of the current page. Much like google does when searching for websites.
Thanks a lot in advance!
Example #1:
http://www.dynamicdrive.com/style/csslibrary/item/css-popup-image-viewer/
Hover your mouse over "Zoka Coffee"..
Try to study about this library html2canvas

How do I make a gallery in WordPress without using a plugin?

I have created a gallery in a WordPress post using WordPress's native media gallery and it shows me the images as gallery thumbnails in rows and columns which is exactly what I want.
But when I click on any of the thumbnail it opens the direct image link. I want that the image should be shown in my blogs environment. I would actually want it to show on the same page itself. but if not that I don't want it to open as a direct image. Is there a template file or something I could make for opening those images. I think image.php, but I have no idea how to go about it.
Help..?
Thanks
When you're inserting a gallery into your post, you can select how to link to the images. See screenshot: http://cl.ly/2yYA
Just select 'attachment page' and you'll get an individual page with commenting for that photo. Is that what you were looking for? You can edit the template of that page using attachment.php.

JS Lightbox for pictures which I want to link to the article the picture is from

I'm using WordPress as my CMS and I just downloaded a Lightbox plugin for a photo gallery on one of my pages. It works exactly how I want it to, except for one thing.
After clicking on a thumbnail to get the photo enlarged with a lightbox effect, I want to be able to click on a link to take me to the main article where that picture is from.
I've tried a few ways but the issue which arises is that I can't pass < ?php the_permalink(); ?> through a JavaScript function. How would I go about to accomplish this?
Thanks to anyone who can help!
The only way to do it is have the image link go to some inline content, which contains the image wrapped in the this is the only way. The lightbox website will have examples of linking inline content, but for every image you will need to generate the inline content, this is the limitations of using a plugin.
If I were in your shoes, I would write a custom modal function, which would take the permalink from an attribute of the image (rel, title, class) and display the larger image linked to the permalink. I am sure you can find a custom modal tutorial, but basically you create a box in your css, which is set to display:none, then when your link(s) is/are clicked, you use jQuery to append one of the boxes to body, append your content into the box, then display it in the center of the screen, using absolute positioning, and opaque to dull everything else.

Categories