Jump to content


Photo
- - - - -

Search function mod


  • Please log in to reply
6 replies to this topic

#1 jonelder

jonelder

    Newbie

  • Members
  • 8 posts

Posted 28 April 2013 - 01:44 AM

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

 



#2 Danny

Danny

    Is Awesome!

  • Moderators
  • 18422 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 28 April 2013 - 09:04 AM

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.



#3 jonelder

jonelder

    Newbie

  • Members
  • 8 posts

Posted 28 April 2013 - 03:13 PM

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.


  • chesleyn likes this

#4 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 28 April 2013 - 03:27 PM

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:

Please Login or Register to see this Hidden Content

 

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.



#5 chesleyn

chesleyn

    Member

  • Members
  • 10 posts
  • Country: Country Flag

Posted 06 January 2015 - 02:22 AM

I am trying to solve the exact same issue that JonElder had in 2013. Downloaded hooker and tried hooking the php code from 

Please Login or Register to see this Hidden Content

and I get nothing. When hooking it to wordpress get_search_form, the site crashes.



#6 Danny

Danny

    Is Awesome!

  • Moderators
  • 18422 posts
  • LocationManchester, UK
  • Country: Country Flag

Posted 06 January 2015 - 01:30 PM

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.



#7 jonelder

jonelder

    Newbie

  • Members
  • 8 posts

Posted 06 January 2015 - 05:01 PM

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.