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

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.

Related

Adding Custom post type title to attached images caption attribute in Wordpress

I trying to resolve an issue that a friend of mine is having with an image heavy Wordpress site.
The site has multiple Custom Post Types and each Post Type has custom fields that allow multiple images to be uploaded.
The problem i'm trying to solve is this; The site has around 40,000 images, most of which are attached to the custom posts mentioned above, these images are used to showcase properties and are combined into preview pages to show to potential clients. Locating the correct images is difficult and i need to add some custom meta data to the images so make them easier to group/navigate.
Ideally i need to add the attachments parent post title into the alt or caption attributes for every image on the site.
Theoretically this would be done by using a default hook to add_filter('foo... I'm just not quite sure how to structure this so that it can run through all old images and future images.
A nudge in the right direction would be very appreciated.
WP_Image_Editor objects that you can perform operations on:
wp_save_image_editor_file
image_editor_save_pre
wp_save_image_editor_file
wp_image_editor_before_change
the first hook is triggered when an image is edited (crop/re-size whatever)
the second one is triggered when you crop/rotate the image and press the Save button (and it's a pre-filter)
for the 3rd one it is important to note that you should use $image->save( $filename, $mime_type ); inside your callback, or you will be left with an image that doesn't get saved. And if you want to do so, then better don't return the $saved with no value/NULL.

Fancybox image gallery with ratings and comments

I have a photo website which gathers images from a folder with PHP, displays their thumbnails on a page and, when clicked, opens a fancybox (fancybox.net) to display the full image. I am pretty satisfied with the result but as users start posting, they start asking for new features, and problems come out since I'm not a programmer. What I would like to do is a photo commenting/rating system (like the one on facebook to get the idea, but obviously not as complex): I've been trying to add a Disqus code to each picture, but it won't get displayed in my fancyboxes...So the question is, can you give me any (easy-to-implement) ideas on how to achieve this? I don't mind using already existing softwares like disqus for comments and polldaddy for ratings, since I guess it would require me to setup a mysql database to do it on my own...
To brief it again:
I have a "thumbs" folder which are gathered on a page.
I have an "originals" folder with the full size images that are called back by the fancybox.
I would like to have comments+rating in the fancybox.
Thanks in advance for any advice you can give me.
For your fancybox implementation I'm assuming that it's just pulling the image into the lightbox, not other content (i.e. a html page). What you'd need to do is set up a page which would grab an image, and output it along with your comments + rating code, then set up your script to use that page as the fancybox URL instead of a direct link to the image.
Without more information to go on I can't really help more than that.
ps for comments the Facebook Comments plugin might be easier for a non programmer to implement than Disqus.

How do I turn a link into an image to embed?

I am attempting to create some functionality on beta.peaksneak.com where users can basically journalize. To do this I want them to be able to add images, videos, quotes, and links to a journal entry.
I found out that you can use oEmbed to embed videos, and images/quotes are easy.
Is there a script for embedding links and auto-capturing a large image from the link to use for embed purposes? For example, on Facebook, when I paste a link into a comment, it automatically generates an image and text (probably from meta tags and the first large image it can find).
You can also try https://github.com/starfishmod/jquery-oembed-all for your oembed stuff - it has a lot of providers and is client side only if that is what you are looking for?

Wordpress - Dynamically Process Image

I have images uploaded in the media library in WordPress. I would like to show the images with text composited on top of them using PHP's GD or something similar.
If this were just a plain old PHP site, I could create a URL with a search parameter for the text and center it over my image with GD and serve it up. In WordPress, I am a little unclear how to accomplish this. I am not sure if it fits well into the concepts of Posts and Pages.
I can perform the programming myself. I am just looking for some pointers on how to get started.
Thanks,
Carl
You can do that in WordPress, too. It's mostly just a plain old PHP site. For example, you could create a PHP file that creates the composite given the text and the image and use it like: <img src="/composite.php?image=...&text=...">.
Maybe all of the images are on a particular page or post type. Then you could create a custom page or post-type template that parses the $post->post_content for the images, does the compositing, and alters the image tags to point to the new composited images.
Or, more generally in that vein, create a filter for the_content that does that for all posts.
You might be able to hook into the WordPress upload system. As images are uploaded, you could create the composite. The wp_handle_upload filter might work for that.
Or you could even create a WordPress cron job that scans the media uploads for new entries and creates the composites then.

how to add images to multiple pages on a wordpress dynamically by the class name

I am currently adding images to the page new on this website but some images I would like to add to the various catagory pages such as new in, crop circles or childrens without having to upload to the different pages seperatley one at a time.
Is there a way to dynamically add the images to other relevant pages depending on the class of the image without having to upload to each page individually using php or ajax which would save lots of time.
or is there a plugin where I can add images to multiple pages at once?
I figure this is an ajax issue but am hoping there is a php wordpress solution.
It would be fab if anyone can help.
umm.. Actually, I dont know any wordpress solution, If I were you, I would create a simple php which can do that logic for you and render a JSON file with your images struct?!

Categories