Adding more fields for search

Hi everyone!

What I'm trying to do is create more fields which displays information about the album and so people can search a specific thing. For example, Colour, Size, Height.

What I'm doing is trying to make a clone of the pre-existing "Location" field because I want these other fields (colour, size, etc) to work in exactly the same manner.

I've edited a few of the files:

album.php (where I want my text to feature) - I've got this part correct.
admin-functions.php
admin-edit.php
template-functions.php
class-search.php

However, I'm getting the error when I try and insert the decription in gallery/zp-core/admin-edit.php:
Fatal error: Call to undefined method Album::getColourOption() in /home/abc/public_html/gallery/zp-core/admin-functions.php on line 1352

Line 1352 is:
<?php print_language_string_list($album->getColourOption(''), $prefix."colour_option", true, NULL, 'hint','100%'); ?>

Not sure if I need to provide more information than that? If so, just let me know.

Any advice welcome.

Thanks!

Comments

  • acrylian Administrator, Developer
    You really should never modify core files as you have to maintain your changes with any update and we won't be able to help with any issues that arrise from that. If you need custom stuff do it on the theme or via a plugin.

    `getColourOption()` is not a an existing class method or function so naturally you get that error.

    The built in search is a one field one as generally and you can set via the search options what fields it should cover.
  • Hey acrylian,

    Thanks for getting back to me. Fair enough, I'll try and do it a different way... probably via a plugin. My PHP knowledge is fairly limited though.

    So, I've tried to do a bit of reading about this. Will the filter-custom_data plugin do what I'm wanting to do?

    Really what I want is different aspects of the photo to be displayed using text, which I'd input myself.

    But, I want to do it when I'm in admin-edit.php. So, I'll have:

    Colour: *Red*
    Size: *Large*

    Where the starred words are fields I'd input into. I also want these to be searchable, similar to if you input a name into the "Location" field, you can search for it. None of what I want to input is metadata.

    Hopefully that makes sense. I'd like to edit something existing if possible.

    Thanks again!
  • if you mean the `custom_data` filters then they will allow you to write a plugin to accept and display these data on the `album/images` tab. To take action on them in your theme is different. You will have to write explicit code for that.
Sign In or Register to comment.