• 0
Sign in to follow this  
Followers 0

Search function mod

Question

Posted · Report post

I am trying to use the search function of pagelines to access key words in my nextgen gallery. The plug in that I am using requires me to add some code to the theme's "search.php" document. I do not find said document in the pagelines theme. All I can find is the searchform.php. When I attempt to add the following code:

 

<?php if ( function_exists( 'ngg_images_results' ) ) ngg_images_results(); ?>

 

 

it disables the sites content from being viewed. Where should I be adding this piece of code in the pagelines framework? thanks for any help

 

Share this post


Link to post
Share on other sites

6 answers to this question

  • 0

Posted · Report post

Hi,

 

We do not recommend editing the core files nor do we support it. If you wish to add this function to your site, I recommend you add this snippet of code to your child themes functions.php file or the customise plugins functions.php file.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

I am a little distressed that you cannot offer me a little more clarity on this. I have attempted your solution of adding the code to my plug-in's function.php, it just breaks the site. Can you offer me any other advice about how to customize my searches to be able to search my keywords in my NexGen gallery. I find it difficult to believe that pagelines is not superior to the standard template. I really do not want to abandon pagelines for twentyeleven.

1 person likes this

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Hi,

 

To clarify, the search function is really that of WordPress, so to accomplish this goal, as Danny said, you need to add the code to the functions.php in your child theme (if using one) or in the PageLines Customize plugin.

 

Here's some documentation about that: http://support.pagelines.me/docs/customization/hooks/

 

You'll want to use the Action Map plugin (free in our Store) and pinpoint the search criteria you want. Once found, You can create a hook which includes the PHP snippet.

 

The reason your site breaks when just adding that code is that it is a PHP script, but so too is the functions.php.  You have to end PHP processing before adding the new script. Once finished, you have to restart PHP.

 

This is generally done like this:

php?> (ends processing)

<php your code>

<?php  (restarts PHP)

 

It's the only safe way to include a PHP process. There's a bit more to it, but between the documentation and the Action Map, you should be able to do it.

 

One easy way is to add the Hooker plugin, select the proper hook from the drop down list and add your PHP code in the edit field.  This will ensure that the hook is structured correctly.  All you do in that edit field is paste your code.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

I am trying to solve the exact same issue that JonElder had in 2013. Downloaded hooker and tried hooking the php code from http://alexrabe.de/2010/01/13/search-for-images/and I get nothing. When hooking it to wordpress get_search_form, the site crashes.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

That post is five years old. Therefore, if you're trying to implement a custom function or search for images etc... then you're going to need to contact the developer of the NextGen gallery plugin, as we can not provide support for third party plugins.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Well it was really only 2 years ago.

I can offer this hope. I did finally get the search function to work using the nggSearch plug in. I was using the Pagelines Framework at that time. I can remember that I did not use the hooker method only the nggSearch plugin, in combination with NextGen Gallery.

I had success adding this snip of code

 

<?php if ( function_exists( 'ngg_images_results' ) ) ngg_images_results(); ?>

 

to the searchform.php file. I placed it at the end after the

 

pagelines_search_form( true );

 

I should note that this gets overwritten with some updates so a child theme would be a good idea to prevent this.

 

I could place tags on images when making my NextGen Gallery. and the search would yield the results of an exact tag word search at the top of the main body of the page. 

 

That being said  My client changed their minds about the function and I have since abandoned the feature. I have no idea if it will still work in DMS. Hope this helps a little.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0