[wp-hackers] need a hand with wp-fancyzoom.

madalin niladam at gmail.com
Thu Nov 20 00:40:59 GMT 2008


I installed the plugin and it works smoothly. However, i also have a
page with a NGGallery, which interferes with fancyzoom (actually both
run) and so i get two effects for the same image.

I tried modifying wp-fancyzoom so that it verifies if the post is
actually a page and to echo something else instead of adding the hooks
to wp_head();

The function looks like this:

// Header hook
function insert_fancyzoom_javascript($unused) {
  $fancyzoom_path = get_option(KEY_FZOOM_DIR)."/";

  echo "\n<script type='text/javascript'>var zoomImagesBase = '".
    $fancyzoom_path."';</script>\n";
  echo "<script src='{$fancyzoom_path}js-global/FancyZoom.js'
type='text/javascript'></script>\n";
  echo "<script src='{$fancyzoom_path}js-global/FancyZoomHTML.js'
type='text/javascript'></script>\n";
  echo "<script src='{$fancyzoom_path}adddomloadevent.js'
type='text/javascript'></script>\n";
  echo "<script type='text/javascript'>addDOMLoadEvent(setupZoom);</script>\n";
}


The register is:

// Register our filters and actions
add_action('wp_head', 'insert_fancyzoom_javascript');
if (get_option(KEY_FZOOM_COMPAT)) {
  add_filter('the_content', 'fzoom_popim_compatibility_filter', 0);
  add_filter('the_excerpt', 'fzoom_popim_compatibility_filter', 0);
}




I tried doing something like:

function insert_fancyzoom_javascript($unused) {
  global $post;
  if ( is_page() ) { echo "<!-- blah -->"; }
  else {
  $fancyzoom_path = get_option(KEY_FZOOM_DIR)."/";

  echo "\n<script type='text/javascript'>var zoomImagesBase = '".
    $fancyzoom_path."';</script>\n";
  echo "<script src='{$fancyzoom_path}js-global/FancyZoom.js'
type='text/javascript'></script>\n";
  echo "<script src='{$fancyzoom_path}js-global/FancyZoomHTML.js'
type='text/javascript'></script>\n";
  echo "<script src='{$fancyzoom_path}adddomloadevent.js'
type='text/javascript'></script>\n";
  echo "<script type='text/javascript'>addDOMLoadEvent(setupZoom);</script>\n";
}
}


Can someone provide me with a quickfix please ?

-- 
Regards,
madalin


More information about the wp-hackers mailing list