Sunday, May 24th, 2009 | Author: pluc | Views: 13,523

Lots has changed since the last article I made about WP-prettyPhoto usage, and so it is time to revamp the instructions, explain new features and hopefully be a bit more thorough. First off, let me first mention the following thing:  prettyPhoto is written by Stéphane Caron. Here are some related links to avoid repeating them throughout this article: Stéphane’s blog, prettyPhoto’s project page, prettyPhoto on GitHub, Stéphane on Twitter, WP-prettyPhoto at WordPress Extend, WP-prettyPhoto Support Forum.

PayPal - The safer, easier way to pay online!

Revision History: This article is intended to document the current WP-prettyPhoto (1.5.1) & prettyPhoto (2.5.2) versions.

Now for some organization, here are the topics that will be discussed in this article:

1. Technical Information

The idea behind WP-prettyPhoto is to avoid having to use Lightbox to display pictures. Lightbox is based on the Prototype JavaScript library, and most WordPress plugins tend to use jQuery. Using WP-prettyPhoto thus allows you to avoid loading multiple libraries to perform a single task. Stephane Caron developed prettyPhoto because the jQuery Lightbox clones, at the time, were close enough to the real Lightbox.

prettyPhoto uses attribute hooks to bind itself on elements to display. In other words, if prettyPhoto finds a rel attribute inside a link pointing to one of its supported format (bmp, gif, jpg, jpeg, png, swf, mov), and that rel attribute matches the one prettyPhoto looks for, it will know that link is meant to be displayed within a prettyPhoto box. Since prettyPhoto 2.4, it also looks for simple text links with the configured rel attribute and the string “iframes=true” within the target URL. Since prettyPhoto 2.5, an API is available.

2. Installing WP-prettyPhoto

The installation of WP-prettyPhoto is pretty straightforward, as with most WordPress plugins. Once you have downloaded the current version of WP-prettyPhoto, you have two options:

  1. Use WordPress’ builtin plugin installation system located in your WordPress admin panel, labeled as the “Add New” options in the “Plugins” menu to upload the zip file you downloaded
  2. Extract the zip file and upload the resulting “wp-prettyphoto” folder on your server under “wp-content/plugins/”.

All you need to do after that is navigate to your blog’s administration panel, go in the plugins section and enable WP-prettyPhoto.

For more information, see the “Installing Plugins” article from the WordPress Codex.

3. Using WP-prettyPhoto

There are several ways to use WP-prettyPhoto on your blog. All of them can be automatically achieved by enabling the “All Formats” option in the “Automate” section of the WP-prettyPhoto settings, located inside WordPress’ Media settings page. All of the “Automate” options will trigger automatic activation of the specific format. That is how to use WP-prettyPhoto automatically. However, some of prettyPhoto’s formats require specific instructions. For all formats, you will need to do the following: Insert the media you want prettyPhoto to bind itself on in your post or page, surround it by a link and make the HREF attribute point to the original media Then, simply add WP-prettyPhoto’s configurable REL string to the link.

It is important to note that there is also a way to exclude specific elements from being displayed in prettyPhoto. To do so, simply make the link point to a new window using “_blank” as the value of the link’s TARGET attribute.

3.1. On images

Manually using prettyPhoto on images is simple.  If you want to display a title inside the prettyPhoto box, make sure the “Display title” setting is activated. When active, prettyPhoto will use whatever is inside the image’s ALT attribute. To display a description, use the link’s TITLE attribute.

To manually insert a prettyPhoto gallery, the process is similar. All you need to do is make sure all your images have the same REL attribute with a slight modification. The REL attribute should define the gallery’s unique name between [square brackets]. Doing so will allow prettyPhoto to display next/previous links as well as display the current picture count and the total pictures found in the gallery.

3.2. On videos and flash

The process of linking prettyPhoto to your video files is the same as images. Link to the .swf or .mov file, then specify the width and height. In the case your flash needs specifics parameters, add &flashparams to the URL specify the parameters.

3.3. On YouTube Videos

To load a YouTube video, simply link to the YouTube video url. You can also add “&width” and “&height” to specify the sizes, if not provided, default dimensions will be applied.

3.4. On External Sites

To load sites in an iframe inside prettyPhoto, link to the desired website and add the following params. “?iframe=true”, to tell prettyPhoto to open the page in an iframe and “&width=300″ “&height=300″, to specify the iframe dimensions.

3.5. Shortcode API Calls

Since WP-prettyPhoto 1.5 and prettyPhoto 2.5, API calls are supported through WordPress shortcodes. There are two distinct shortcodes available to users, please note that shortcode usage must first be enabled in WP-prettyPhoto settings.

  • [ppo img="" title="" desc="" button="false"]Text[/ppo]: Opens a prettyPhoto box using img value for image source, title value for title, desc value for description. If you want to display a button instead of a link, set the button parameter to true.
  • [ppg files="" titles="" desc="" button="false"]Text[/ppg]: Opens a prettyPhoto gallery using files values for images, titles value for image titles and desc values for descriptions. All values should be comma-separated and ordered properly. The second desc item corresponds to the description of the second files item. Here again, you can output a button instead of a link using button=”true”.

4. Examples

  • Simple image hook with no title and with description.
    <a title="Simple image hook with no title and with description." href="http://blog.fusi0n.org/wp-content/uploads/2009/05/avatar-trans.png">Simple image hook with no title and with description.</a>
  • YouTube video
    <a href="http://www.youtube.com/watch?v=oHg5SJYRHA0" rel="wp-prettyPhoto">YouTube video</a>
  • Flash Movie
    <a href="http://movies.apple.com/movies/weinstein/nine/nine-tlr1_h.480.mov?width=480&height=204" rel="wp-prettyPhoto">Flash Movie</a>
  • External Site
    <a href="http://m.reddit.com/?iframe=true" rel="wp-prettyPhoto">External Site</a>

Category: WP-prettyPhoto
Responses are currently closed, but you can trackback from your own site.

140 Comments

Pages: « 1 2 [3] 4 5 6 7 8 9 10 11 … 14 » Show All

  1. I’m still on v1.1.4.

    I don’t know if it’s brought up before but when one is using a gallery of images, is there a way to get the text in the “Caption” or “Description” fields of an image to be shown in the WP pretty-photo window?

  2. @onelargeprawn From the prettyPhoto setup instructions:

    To have a title displayed on your picture, you need to modify the “alt” attribute of the image to the desired title. To have a description for your pictures, you need to modify the “title” of the link to the desired description.

  3. Thanks pluc.

    One more question on v1.1.4 if you don’t mind. In the WP-prettyphoto options, I’ve selected the “Allow resize” checkbox.

    Now in my latest post, http://www.onelargeprawn.co.za/2009/05/19/a-day-in-the-life-told-in-logos/, I’ve linked a smaller image to one that is significantly larger. When I click on the image, WP-prettyphoto seems to enlarge the image even more, and it seems everytime I try to scroll to the bottom to click Close, the window takes me back up. I scroll down again, and it moves back up again.

    Do you know why this might be happening?

  4. I’m trying to get a youtube video hyperlink to open into a prettyPhoto lightbox without success.

    The plug-in works perfectly when I link URLs of single images, galleries, etc., but not with Youtube videos.

    My settings are on auto prettify and I’ve checked the box to enable it for flash videos.

    Should this not work automatically?

    I’ve also tried manually editing the html post (although I have no programming skills) like the youtube example you provided. Still no luck…any suggestions would be most appreciated.

  5. Not sure how, but now it seems to all work automatically (no coding on my part) except embedded youtube videos play at full-screen, which is not how I’d like it…appreciate any help since the frames of prettyphoto are more to my liking than another alternatives….thanks

  6. Cannot work, cause no php in the zip to let it show up in the plugins-area. In which files to add the extralines noted in the no-margin-…page? This is mysterious to novice users. There seem to be different ways to install?

  7. @Nathan First things first. You’re using WP-prettyPhoto 1.2.1.3. The version in which most of the things described in this article is 1.3 (as stated at the beginning of the article). It will be released most likely next week, I have some tests left to do but other than that it’s complete. Feel free, however, to download the 1.3 beta release yourself. Just go to http://wordpress.org/extend/plugins/wp-prettyphoto/download/ and get the “Development Version”. Let me know how that works for you.

  8. @onelargeprawn It seems to work fine for me (Firefox 3.0.1 under Ubuntu Jaunty). See screenshot of visible portion at http://imgur.com/Y1CfH.png – However, I can imagine why it wouldn’t work. prettyPhoto is made in such a way that it tries to keep its window always visible until closed. Drop a line to prettyPhoto’s author and see what he thinks.

    @Matthias You’re downloading prettyPhoto, and not the WordPress plugin WP-prettyPhoto. You can download WP-prettyPhoto at this address: http://wordpress.org/extend/plugins/wp-prettyphoto/

  9. thanks, i’ll just wait for 1.3…the development version calls itself 1.2.1.3 after installing and activating it from my wp plug-in dashboard and I still can’t get it to load youtube videos in prettyphoto boxes.

  10. Is there any way to link to a Dailymotion video using wp-prettyphoto?

Pages: « 1 2 [3] 4 5 6 7 8 9 10 11 … 14 » Show All