Jump to content


Photo
- - - - -

Search function mod


  • Please log in to reply
3 replies to this topic

#1 jonelder

jonelder

    Newbie

  • Members
  • 7 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
  • 17945 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
  • 7 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.



#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.