WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
Bug: ngg_render_template filter (2 posts)

  1. Paul Clark
    Member
    Posted 4 years ago #

    In Next Gen Gallery 1.5.5, line 261 of core.php reads:

    $custom_template = apply_filters( 'ngg_render_template', false, $template_name );

    The apply_filters function only takes two arguments, not three; The hook $tag and the $value to be modified. Because $template_name is the third argument, it doesn't get passed to the filter. Instead the filter is always passed FALSE, which makes it impossible for plugins to detect what template is being requested through this filter.

    Instead, the line should read:
    $custom_template = apply_filters( 'ngg_render_template', $template_name );

    http://wordpress.org/extend/plugins/nextgen-gallery/

  2. Alex Rabe
    Member
    Posted 4 years ago #

    This is the way how it works for me :

    add_filter('ngg_render_template', array(&$this, 'add_template'), 10, 2);
    
    function add_template( $path, $template_name = false) {
       if ($template_name == 'custom-name')
          $path = WP_PLUGIN_DIR . '/' . plugin_basename( dirname(__FILE__) ) . 'custom.php';
       return $path;
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.