Nextcellent, AdSense, Browsing & More

google-adsense

Recently I have an interesting question I’d like to share with you:

Hi,
I have installed your plugin at xxxx….
Actually i don’t want to show image in light box. I want that when someone click on image then it should open in separate page where there should be PREV and NEXT link, so that i can get benefit of google adsense with reload each separate image.

I could not found how to do it. Can you help me?

Actually, this is easy to do, but I found documentation is rather poor and I have to work hard on that.

Summary

If you activate ImageBrowser Option (Galleries->Settings->Gallery->ImageBrowser):

imagebrowser-pic

The following things are going to happen:

  • You’ll  set all images on the website on browser mode.  That’s means everytime you click over an image on ANY gallery you will be in fact browsing a page with an image inside.
  • Most of scripts (like Lightbox, Shutter, etc.) won’t work in order of enable page navigation.
  • Use ImageBrowser Template to control how the images will be displayed.

That would be useful to combine this with advertisement plugins. Including advertising needs template modifications and it will be subject to another post.

Also, please notice that:

  • ImageBrowser overrides any other Nextcellent browsing configuration . What I’m saying is that the Effect Tab on plugin settings won’t work on galleries while ImageBrowser is active. With ImageBrowser on, galleries operate only using page-browse functionality.
  • ImageBrowser disables javascript on the gallery in order to navigate properly.

 

¿What if I’m just want to use ImageBrowser on some specific galleries?

Being ImageBrowser an all-or-nothing option restricts plugin flexibility. For one side, if ImageBrowser is on and the page traffic is increased (a lot) . Switch it off and image browsing will be solved with Javascript + Ajax.

Filters to the rescue

ngg_show_imagebrowser_first is a filter that will allow to enable specifically some galleries to browse, leaving the rest working with normal settings.

To make use of this filter, ImageBrowser option has to be OFF (I mean, unchecked) , otherwise you won’t be able to appreciate if it is working.

Example: drop this code on functions.php file on your theme

add_filter("ngg_show_imagebrowser_first","enable_gallery_for_browsing",10,2);
function enable_gallery_for_browsing($value,$galleryId) {
    //list of galleries Id's you want to enable browsing
    $enable_browsing = array(4,19);
    return (in_array($galleryId,$enable_browsing));
}


This filter will enable galleries 4 and 19 to work on ImageBrowser mode, leaving the rest with normal settings. Feel free to change array values to check its working

No Comments


Leave a Reply

Your email address will not be published Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*