WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN-Galleryview
[resolved] Replaces all galleries, not just ones with specified template (15 posts)

  1. natewiebe13
    Member
    Posted 1 year ago #

    Updating to the latest version of this plugin completely replaces all galleries. It should only replace shortcodes with template="galleryview"

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

  2. vtxyzzy
    Member
    Posted 1 year ago #

    I believe the problem is that function add_template() in nggGalleryview.php does not check for the galleryview template before altering the path.

    I think changing that function to the code below will correct that problem:

    // Add our Template
    		function add_template( $path, $template_name = false) {
    			if ($template_name == 'galleryview') {
    			   // Check theme for template first
    			   if ( file_exists (get_stylesheet_directory() . "/nggallery/gallery-galleryview.php")) {
    				   $template_name == 'gallery-galleryview';
    				   $path = get_stylesheet_directory() . "/nggallery/gallery-galleryview.php";
    				}
    				else  {
    				   $template_name == 'gallery-galleryview';
    				   $path = WP_PLUGIN_DIR . '/' . plugin_basename( dirname(__FILE__) ) . '/view/gallery-galleryview.php';
    				}
    			}
    			return $path;
    		}

    Note also the change to get_stylesheet_directory() instead of TEMPLATEPATH. This allows the plugin to work with child themes.

  3. vtxyzzy
    Member
    Posted 1 year ago #

    Small change to allow multiple galleryview galleries:

    // Add our Template
    		function add_template( $path, $template_name = false) {
    			if ( preg_match('/^galleryview(-.+)?$/', $template_name) ) {
    			   // Check theme for template first
    			   if ( file_exists (get_stylesheet_directory() . "/nggallery/$template_name.php")) {
    				   $path = get_stylesheet_directory() . "/nggallery/$template_name.php";
    				}
    				else  {
    				   $path = WP_PLUGIN_DIR . '/' . plugin_basename( dirname(__FILE__) ) . '/view/gallery-galleryview.php';
    				}
    			}
    			return $path;
    		}

    This makes it possible to use template names like template='galleryview-frontpage' to load the gallery-galleryview-frontpage.php file, thus using different templates for different galleries.

  4. vtxyzzy
    Member
    Posted 1 year ago #

    I am always too quick to post. Disregard the last post. I can't get this to work on a live site - only on my test site using this code:

    // Add our Template
    		function add_template( $path, $template_name = false) {
    			if ( preg_match('/^gallery-galleryview(-.+)?$/', $template_name) ) {
    			   // Check theme for template first
    			   if ( file_exists (get_stylesheet_directory() . "/nggallery/$template_name.php")) {
    				   $path = get_stylesheet_directory() . "/nggallery/$template_name.php";
    				}
    				else  {
    				   $path = WP_PLUGIN_DIR . '/' . plugin_basename( dirname(__FILE__) ) . '/view/gallery-galleryview.php';
    				}
    			}
    			return $path;
    		}
  5. vtxyzzy
    Member
    Posted 1 year ago #

    OK - the code above is working. The problem on the live site was a conflict with another plugin. Disabling that plugin fixed the problem.

  6. Brandon Hubbard
    Member
    Plugin Author

    Posted 1 year ago #

    @vtxyzzy - Thanks for the fix. Updated the plugin.

  7. vtxyzzy
    Member
    Posted 1 year ago #

    Kudos for the quick response!

  8. gkrehel
    Member
    Posted 1 year ago #

    Hello ... this thread makes me think that it's possible to have different galleryview templates at work at the same time. However, I can't seem to find any indication of what exactly which files need to be copied/renamed/edited to permit such a super thing. Probably a matter of my being extra dense, but I would greatly appreciate any direction you can provide me. Thank you very much! Greg

  9. vtxyzzy
    Member
    Posted 1 year ago #

    Yes, it is possible. Follow the instructions for "Installation->Advanced Usage" for the NextGEN-Galleryview plugin.

  10. gkrehel
    Member
    Posted 1 year ago #

    Thank you very much for your quick response. I thought I had read that section, but must have missed it and will go hunt it down now. Thanks!

  11. gkrehel
    Member
    Posted 1 year ago #

    Well okay ... either I wasn't clear initially or I'm missing something now. The advanced instructions explain how to edit the galleryview template to change parameters such as where the film strip appears, sizes and so on and I've done that successfully. However, what I'm hoping to do but don't see how to do is to create a new and additional gallery view template with different characteristics so I can use different galleries at different locations.

    Again, I'm probably just being super dense and I apologize if that's the case. Above you reference creating multiple galleries, for example one for use on the front page "galleryview-frontpage." I've tried creating copies of the gallery view.php file with new names and editing them and calling their template name, but I do not get any different behavior. So I'm doing something wrong obv and figured I was missing several steps.

    Sorry again for being dense and any further direction would be greatly appreciated.

  12. vtxyzzy
    Member
    Posted 1 year ago #

    It may be because of the way the template names are used. The actual template name you use (in the "template=xxx" parameter in the shortcode) is prefixed automatically with 'gallery-' to get the file name.

    The 'galleryview-' part is required by the plugin.

    So, 'template=galleryview' would look for file 'gallery-galleryview.php'. Similarly, 'template=galleryview-frontpage' would look for 'gallery-galleryview-frontpage.php'.

  13. gkrehel
    Member
    Posted 1 year ago #

    Okay ... I'll dink around further and see if I can't get it working. Thank you for reassuring me that it is possible and it sounds like there isn't something major I'm failing to do. Thanks again!

  14. vtxyzzy
    Member
    Posted 1 year ago #

    One other point: the templates must be in a directory named 'nggallery' in your theme directory.

  15. gkrehel
    Member
    Posted 1 year ago #

    Bingo! I had created a nggallery directory within the overall themes directory, not within the specific theme. Thanks so much once again! Greg

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.