The searchbox shortcode hr_SIS_nextgen_searchbox provides the same functionality as the searchbox widget:

  • it places a searchbox on any page or post
  • it accepts search parameters, which can be set differently for public users and for logged in users
  • it accepts the same parameters as the widget provided searchbox, but also accepts additional parameters
  • it passes the search text entered by users together with its search parameters to a display shortcode hr_SIS_display_images for displaying the result list of the search

However, whereas the widget provides a graphical interface for defining its parameters, there is no graphical interface for defining the shortcode parameters. All shortcode parameters have default values which may be differently for logged in users and for public users. If not explicitly defined in the shortcode, these parameters are set to there default values, depending on whether the current user is public or logged in. If parameters are defined explicitly in the shortcode, this will override any preset default values.

A list of all parameters and their default values is provided further down this page.

The widget provided searchbox will sent the search request to the automatically generated search landing page, where the display shortcode will generate and display the search result list. In contrast to this, the searchbox shortcode can sent the search request to any page or post by specifying the corresponding url as a target parameter. By default, this target parameter points to the current page or post where the searchbox shortcode is defined.

The searchbox shortcode will place a searchbox at the current location of the searchbox shortcode. This is the same searchbox as is provided by the searchbox widget. Again, the design of this searchbox will heavily depend on your chosen theme for styling. You may need some CSS customization to get the styling you are looking for. On the plugin settings page you can choose between two stylings for the searchbox:

The most difficult part is to style the magnifying glass in the correct size, in particular if your theme is responsive and dynamically adjusts sizes. In certain situations it might be best to hide the magnifying glass by CSS customization completely.

The searchbox shortcode accepts the following parameters:

parameter description default
public user
default
logged in user
placeholder_text displayed text in searchbox before entering search text (*1*) (*1*)
limit maximum number of images in search result list =30 =80
searchsize minimum length of search text =3 =2
search_title 0/1 indicator (*2*), search in NextGEN image title =1 =1
search_descr 0/1 indicator (*2*), search in NextGEN image description =1 =1
search_file 0/1 indicator (*2*), search in filename =0 =1
search_tags 0/1 indicator (*2*), search in NextGEN image tags =1 =1
include_galleries all/selected indicator (*3*) =all =all
search_galleries empty list or list of gallery ids, seperated by commas (*3*) =“ =“
search_album empty list or list of album ids, seperated by commas (*3*) =“ =“
exclude_galleries none/selected indicator (*3*) =none =none
excluded_galleries empty list or list of gallery ids, seperated by commas (*3*) =“ =“
excluded_albums empty list or list of album ids, seperated by commas (*3*) =“ =“
list_pid 0/1 indicator (*4*), NextGEN image / picture id =0 =1
list_title 0/1 indicator (*4*), NextGEN image title =1 =1
list_descr 0/1 indicator (*4*), NextGEN image description =1 =1
list_date 0/1 indicator (*4*), NextGEN saved image (creation) date =0 =1
list_file 0/1 indicator (*4*), image filename =0 =1
list_file_size 0/1 indicator (*4*), NextGEN compressed  image file size =0 =1
list_bu_size 0/1 indicator (*4*), uncompressed original uploaded image file size =0 =1
list_uploader 0/1 indicator (*4*), internal field containing user id of image uploader =0 =0
list_tags 0/1 indicator (*4*), NextGEN image tags =1 =1
list_gal_id 0/1 indicator (*4*), NextGEN gallery id of image =0 =1
list_gal_name 0/1 indicator (*4*), NextGEN gallery name of image =1 =1
list_gal_descr 0/1 indicator (*4*), NextGEN gallery description of image =0 =0
target target url of page or post, which will show the search result list (display shortcode must be present) (*5*) (*5*)
form_id      

(*1*) The default placeholder_text is set to  __(„Enter searchstring for images“, „ngg-smart-image-search“). This text is prepared for translations, if available. Overwriting this text individually will no longer be available for translations.

(*2*) These indicators mark the image metadata fields by 1, where the search text is searched for.

(*3*) Here you define the scope of the entered search.
Either you search in all galleries by include_galleries=all (which will not specify any gallery) or you search only in a list of specified galleries by include_galleries=selected . In this case the provided list of albums, if defined, will be exploded to a list of contained galleries. This gallery list will then be merged with the list of explicitly listed galleries, if defined. The resulting gallery list will be passed to the search execution as a constraint. Note that for a list of comma seperated values you have to enclose them with quotation marks:  i.e. search_galleries=’1,2,3′.

Using the parameter exclude_galleries you can define restrictions for the search scope. If no galleries are excluded by exclude_galleries=none, there are no restrictions. Otherwise by exclude_galleries=selected there will be a list of excluded galleries (albums again will be exploded to galleries) defined by the parameters excluded_albums and excluded galleries. If the search is defined for all galleries above, this exclusion list will be passed to the search as an additional restriction. If the search above defines a list of search galleries, this search gallery list is possibly shortened by the excluded gallery list, if both lists contain common galleries.

(*4*) These indicators mark the image metadata fields, which shall be shown in the search result list. However, this only applies if the search result list is displayed as a single image list or as a linked image list. Otherwise they are ignored. If you use a native NextGEN Gallery display type, only the native NextGEN Gallery fields can be documented.

(*5*) By default, the target parameter is not set. In this case the search request will be directed to the current page or post, which contains the searchbox shortcode. Otherwise the target parameter must provide a valid url of a page or post, which also contains a display shortcode to list the search result.

The listed parameters will apply for all users, i.e. for public users and for logged in users. They will overwrite any corresponding default parameter values. If you want to define different parameter values for logged in users and for public users, you have to use the prefix pu_ for public user and the prefix lo_ for logged in users for each parameter.  I.e. pu_limit=20 will only limit the search result list to 20 images for public users, lo_limit=100 will limit the search result list for logged in users.

Abonnieren
Benachrichtige mich bei
guest
10 Comments
Inline Feedbacks
View all comments
Sven
Sven
14. März 2023 19:50

Mein vorheriger Beitrag hat sich soeben erübrigt, ich wurde im Support-Forum fündig ;-).

Sven
Sven
14. März 2023 18:12

Hallo Herr Röh, vielen Dank für die Bereitstellung des tollen Plug-Ins. Wir hier erwähnt, kommt es auch in meinem Fall zu Problemen bei der Darstellung der Lupe. So nimmt die Lupe beispielsweise beim Sidebar Widget die volle Länge der Sidebar ein. Sie schreiben, dass man die Lupe ganz ausblenden kann. Ist das ohne größeren Aufwand möglich? Falls ja, mache ich das im Plugin Editor oder im Theme unter „Zusätzliches CSS“? Ist es Ihnen möglich mir mitzuteilen, an welcher Stelle ich was tun muss? Ich möchte gerne die Einstellung „General Theme Style“ verwenden. Das wäre super! Vielen Dank und liebe Grüße

Ralph Kunadt
Ralph Kunadt
18. Februar 2021 12:17

The more I’m working with the plugin, the more I like it!

One other question has come up: Is it possible to add the searchstring to the URL, i.e. for instance http://www.abc.com/search?query=xyz or something like that? The idea would be to be able to share the link and people would directly get to see the appropriate search results.

Oh, and have you ever considered setting up a possibility to donate for the plugin? I’d be happy to do so to honor your work.

Ralph Kunadt
Ralph Kunadt
19. Januar 2021 14:01

Many thanks for your great work! Is there a way to put no limit for the number of images in the search result list? I tried „0“, but this doesn’t work.

Mahmoud Soliman
Mahmoud Soliman
17. September 2020 17:02

How can I put only file name without any details with image?