WPG2 image block widget

Important note: 12 August 2007

As of v3.0, WPG2 includes a widget. So this widget is now obsolete.

Last update: 19 December 2006

There’s seems to be more and more support for Widgets. So, I thought it would be good to have a widget for WPG2 image block. I’ve created a simple one and it’s still a work in progress so suggestions and feedback would be most welcome.

You can download it here: WPG2 Image Block widget (version 0.3.1)

Features:
1) Customizable block title
2) Support for single image block or grid block
3) Possibility to input a specific album or photo ID for the single image block
4) Possibility to input a custom CSS class

To do:
1) Check that the input ID is an integer. If it isn’t, return an error.

38 Responses to “WPG2 image block widget”


  1. 1 Itep Edor

    Hi thanks a lot! I like it very much!
    I have no idea about programming in php but I could ad these lines and I can choose now, which album to play. Now I would like to ad a field, where I can put the id number, so I dont have to change the code every time I like to change the album or picture. But I have no idea, how I could solve the problem. Maybe you could give me a little help!

    Thanks

    Peter

    } else if ($type == 3) { print g2_sidebarimageblock(778);

    echo ‘ Selected image’;

  2. 2 Aylwin

    Good idea! I’m not very good with php myself but this shouldn’t be too difficult to code. I’ll try to get this done within the next few days.

    Cheers,
    Aylwin

  3. 3 Itep Edor

    Ok, I have done it! But you can only choose an album, not a picture. It doesn’t work properly.
    From the “Sidebar Options” you can choose “Random Image”, “Recent Image” or “Viewed Image”. To get the Id of the album, you click on an album in Gallery, then you point on the link of your Gallery (upper left corner) and in the status bar you will see the Id of your album.
    This number you can use in the widget.

    You can download it here: 

    http://www.rodehacke.ch/Blog/wp-content/uploads/2006/05/wpg2image_widget.zip

    Greetings Itep Edor

  4. 4 Aylwin

    Actually, I’ve done something too! :) It still needs work but I’ve made it available for download anyway. When I have some time, I’ll check your version to see what we can combine. If you can, please check my latest version also.

    Thanks,
    Aylwin

  5. 5 Itep Edor

    Hi, that’s great! :) I think they are about the same. Also in your version, I cannot choose a single picture. This might be, because they have another path.

    Greetings

    Itep Edor

  6. 6 Aylwin

    I’ve just uploaded a newer version. I’ve added the possibility to input a custom class.

    By the way, I noticed on your website that you’ve credited Fredrik Fahlstad as the author of the plugin. Actually, he’s the author of one of the theme’s I’m using on this website.

    I’m the author of the plugin. :)

    Aylwin

  7. 7 Itep Edor

    Oh, I’m sorry. I corrected that. As I mentioned above, I’m a beginner, so I don’t understand how I could choose a single picture and how I could use a custom class.
    It would be nice, if you could help me a little…

    Thanks, Itep

  8. 8 Mr Paap

    Hey Aylwin, I must be missing something here… The version available for download is 0.3. I dont see how to add the custom class in this version. Did you really upload it or am I going to feel really stupid :)

    Mr Papa

  9. 9 Mr Paap

    Okay, sorry but just looked at the one downloaded from the link above that says v 0.3 but the widget internally says its v 0.2

    Mr Papa

  10. 10 Aylwin

    Sorry about that! I thought I updated the download version but it seems not. Anyway, it should be okay now.

    For adding the custom class, simply enter the name.

  11. 11 Mr Papa

    Thanks… yeah the problem was there was no field since it was the “older” version. Will grab this one… Thanks again… Oh wow, even typed my name in wrong in the first two posts… hehehe

    Mr Papa

  12. 12 Jonathan Poh

    Hi, Thanks for the widget. I’m pulling my hair out on another gallery/wordpress/wpg2 issue. I’m trying to add a link to my embedded Gallery2 page in my Pages list in the sidebar. I see you’ve got that happening on this site, I’m curious as to how you did it.

  13. 13 Aylwin

    Actually, I’ve ‘cheated’. I put the link in there manually. You can see here from the code I used for the Almost Spring sidebar:

    < h2>< ?php _e('Pages'); ? > < /h2>
    < ul>
    < li class="page_item">< a href="/gallery/" rel="nofollow" rel="nofollow" rel="nofollow" rel="nofollow" rel="nofollow">Gallery< /a>< /li>
    < ?php wp_list_pages('title_li='); ? >
    < /ul>

  14. 14 Jonathan Poh

    Thanks for the reply! My search goes on… I’ve manage to hack together a workaround using a WP plugin called ‘Page Links To’, which allows redirecting any Page to any URL so i’ve made /gallery point to /wp-gallery2.php, and using Redirects in Gallery to display /gallery/ as the root of the gallery itself. However, this still shows /wp-gallery2.php in the address bar, which I am trying to avoid… See it in action: http://www.fridayclubcentral.com

  15. 15 Aylwin

    Instead of Redirects, you can use Rewrites. This will show /gallery/ and allow you to eliminate the visibility of /wp-gallery2.php. You can see it working on this site. I’ve written instructions on this at the WPG2 forums: http://www.galleryembedded.com/forums/viewtopic.php?p=14172#14172

    Thanks for the tip on the plugin. I’ll check it out.

  16. 16 oleKanin

    Hi,
    I’m trying to use your widget on my blog ( http://olekanin.zapto.org ), but the images will not line up(i.e. center) correctly in the sidebar. I’m using the ocadia theme (downloaded from galleryembedded.com, guess it’s your version).
    Any ideas?

  17. 17 Aylwin

    Sorry for the late reply. It seems the centering doesn’t work if the images have borders. I haven’t figured out how to fix this.

    In the meantime, if you remove the borders then the images should be centered.

  18. 18 oleKanin

    I must be doing something else wrong. I have tried to use both single-image and block type, both with and without borders, but no luck :(

  19. 19 Aylwin

    In the Custom Class field, try putting g2image_centered.

  20. 20 oleKanin

    That helped! Not quite centered, but maybe close enough.

    Thanks!

  21. 21 Mannie

    Thanks for this nice widget.
    Works fine for me, still changing the template i’m using to my needs. Takes time hehe specially if you arent that good at it ;).
    Glad i found the answer to centering the image here

  22. 22 JP

    Hi Aylwin,

    Great widget. Question: is it possible to get a type space below the block title and before the images? Where would I put this to get that affect on my site? http://thepolettos.com

    Thanks,
    JP

  23. 23 JP

    Crap, it didn’t show the code. Should read ” … a break “br /” type space …”

  24. 24 Jimisola

    Hi Aylwin,

    Nice plugin. I have a simple question: why is the text “Random Image” shown instead of the short desc of the image?

    I’m looking at your site and see that you seem to have the image desc shown below the picture, but on my site I have “Random Image” shown above - no sign of any description. Am I doing something wrong?

  25. 25 Aylwin

    JP, sorry for the delayed reply. If you want a gap between the block title and the images, I think you’ll have to use the $before_title and $after_title variables. I don’t remember how to use them though. So another option would be to simply modify the plugin/widget itself. Look for the following code:

    echo $before_widget . $before_title . $title . $after_title;

    That’s the block title so you can modify it as needed.

    Jimisola, go to WP Site Admin -> WPG2 -> Sidebar Options. On that page/tab, look for Sidebar Block Details. Make sure Title is checked and then click the Update Options button. Is this what you need?

  26. 26 Jimisola

    @Aylwin, that was it! :) Thank you. I was looking at the widgets options and forgot totally about that configuration page. Once again, thanks..

  27. 27 Missty

    Hi Alywin,

    Love the widget!
    Is there a way to use multiple of them? I would really like to have one with random images from one gallery and one from the other! :D Thanks!

    Missty

  28. 28 Aylwin

    I think you can create a copy of the widget, rename it and install it again as another plugin. Then it’ll show up as another widget. If that doesn’t work and causes problems, then I guess you’ll need to rename the variables used.

  29. 29 Bernard Doddema

    How do I get the thumbnails to form a 2×2 grid using the widget? Is that something I do in custom class?

  30. 30 Feppa

    Any news on getting thumbs to form a 2×2 grind using this widget? I really would like this.

  31. 31 Corazon de Una Madre

    YAY!!! After several days and many hours spent reading multiple forums, I came across your post with the link to your wpg2image-block widget. I installed it, activated it, and … it works!!! YAY!!! GOLD STARS!!! I could HUG you!!! Thank you SO much!!! Your widget should be a core element for WordPress… I LOVE IT!!! Kiitoksia!!! =D

  32. 32 Jonathan Cutting

    Thanks, this widget is great!

  33. 33 Yotsume

    Problem With You Widget Layout:

    Hello, I have a small layout problem with your widget. I have
    Title, Date, Views, Owner, Heading all check in my sidebar options. The problem is it displays under the photos on my sidebar with no spaces between these listings like this:
    Fish Face 002
    Date: 04/17/2007Views:
    1Owner: john

    So the Views is right next to the date and breaks to the next line where the view number shows right next to Owner. How can I possible fix this?

    I have all this installed on another site of mine and it shows fine but with a older version of Wordpress and Gallery2.

    I use:
    Wordpress v2.1.3
    Gallery2 v2.2
    WPG2 v2.13

    Any ideas???

    Thanks,
    Yotsume

  34. 34 john

    Great Widget. I love it! How are you able to display the gallery navigation on your sidebar? Also, is there a way to have the title field of the widget point to the /wp-gallery2.php so that users can click on the title and go to the main page of the album?

  35. 35 Aylwin

    Yotsume, the latest version of WPG2 includes a widget. So this one is really only for older WPG2 versions.

    John, I haven’t “officially” relased the gallery navigation block but you can find it here:
    http://www.galleryembedded.com/forums/viewtopic.php?t=3897

    As for making the title clickable, I’m not sure how it can be done.

  36. 36 Joe

    Does this widget supports wp 2.2.2? I’ve actived the plugin and drag it to sidebar but no image shows

  37. 37 Aylwin

    I’m not even sure it supports WP2.1. :) This was made awhile back for WP2.0. The latest version of WPG2 (v3.0) should have widgets already built in so my widget is now obsolete.

  1. 1 WordPress Plugins Database » Plugin Details » WPG2 Image Block widget

Leave a Reply