WordPress.org

Ready to get started?Download WordPress

Forums

NextGen Gallery Search by category issue (1 post)

  1. rmocanu
    Member
    Posted 2 years ago #

    Hi,
    I recently installed the Nextgen gallery plugin along with the ngg search plugin. Unfortunately when I search by category it always display the same results no matter which category I chose to search. I figured out this is a result of the galleries not being assigned any category. At the moment I thought of 2 ways of going about this but unfortunately I lack the skill for both, so maybe someone with a bit of knowledge can help me out.

    1) Is there any way to assign a WP category to any of the ngg galeries?

    2)Since my site only has 2 categories in which the ngg gal are displayed I tried making this code:

    <?php if(is_search()) {
    $search = $wp_query->get('s');
    	$keywords = preg_replace('/\+/',' ',$search);
    	if (function_exists ('ngg_images_results')) {  // function from functions.php
    		$nggpictures = ngg_images_results($keywords, ''); // put the number of pictures by row you want, if you don't want "4"
    
    		if ($nggpictures) {
    			echo "<h2>Pictures</h2>";
    			echo $nggpictures;
    		}
    	}
    } ?>

    which I included in my themes search.php but I don't know how to limit the search to only the few categories I have.or if the search.php will allow 2 <?php if(is_search()) instances.

    Any suggestion or help with this issue is greatly appreciated. Thanks in advance

Topic Closed

This topic has been closed to new replies.

About this Topic