Log in
You shouldn't have to be an expert to be safe on a computer.

Home

Guides

Seminars

Tips and Tricks

Jsearch2 Setup and Configuration

Saturday, May 21st, 2011 (59 comments)

If you want to use Jsearch on your site, download it here:

Installation

Once downloaded, follow these instructions:

  1. Unzip the plugin to your plugins/jsearch folder like this:
    Just like every other plugin really...
    Just like every other plugin really...
  2. Copy the jsearch_template.php file to your current theme's directory so it's available to your theme to be selected as a page template.
  3. Create a new page and select the Jsearch template from the Template drop-down list. This newly created page will be your search landing page.
  4. Click on the "Jsearch Config" link in the tools or plugins area on the left menu in the WordPress dashboard. Once there, select the page you just created in the drop-down list (so the plugin knows which page is using the template) and click "SAVE" at the bottom of the settings page.
  5. Mess with the other settings if you wish, but you're basically done (if you do change something, remember to click "SAVE" at the bottom to save the changes).
  6. (Optional but recommended) Replace the normal search widget in your sidebar with the Jsearch equivalent. This customized search box will feed directly to the Jsearch page and contains an "Advanced Search" link that will go directly to the search page without having to enter any terms first (it's with all the other widgets on the widgets page).

This is probably not the most elegant and awesome way possible to make this all work, but it's all I could figure out.

Options

The Jsearch control panel in the WordPress dashboard
The Jsearch control panel in the WordPress dashboard

By default, the behavior of Jsearch is determined by what I thought was best. If you want to change that, you can do so in the Jsearch options screen. Besides changing the defaults, you can hide certain controls from your users if you don't want them to make changes or think that it would only confuse them (or take up space that's not needed).

Customizable Results

There are 2 default listing styles (Jsearch default and WordPress default) and 3 custom templates that can be configured as needed.

Jsearch default
Jsearch default
Wordpress default
WordPress default

This allows you to style and customize your results just like you would for any WordPress template. You can also have multiple views in the same WordPress installation depending on the need. For example, for normal results on my City of Heroes fan page, I like the results to be the Jsearch Default, but then I used the Custom1 template and customized it to show a thumbnailed list when browsing the image gallery.

Using the custom templates to do a thumbnail search (example only)
Using the custom templates to do a thumbnail search (example only)

Note that the custom template I used to make the thumbnails is included as Custom1 as a sample, but will not work on your page since I use another custom plugin that you don't have in it. It is only included so you can see how the code can be done (if you want to see it working, go here: Jordan's Town Gallery).

Full URL Customization

Every aspect of the jsearch control (and a few others) can be set via the URL. For example, the thumbnail search I just mentioned is triggered by loading the search page with the following variables in the URL string:

http://www.jordans-town.com/jsearch/?paged=295&cat_all=106&ppp=24 &results_type=custom1&order=asc

  • &cat_all=106 – 106 is the id of the Gallery category. This restricts all results to gallery photos only
  • &ppp=24 – Sets the number of posts per page to 24
  • &results_type=custom1 – Sets the results template to Custom1
  • &order=asc – Sets the results to show in ascending date order (WordPress default is descending order). I do this for my gallery so that when you bookmark a page, new additions don't change the photos that are on page 295 for example.

Using this method, I can have the standard defaults as set in my administration panel, but create tailored views on the fly using nothing more than a link with some variables.

Jsearch Widgets and Inputs

There are a variety of controls that can be used to launch the Jsearch page:

Google-like Jsearch Box

The Jsearch box when undisturbed and then with data being entered. Hit ENTER to submit the entered terms
The Jsearch box when undisturbed and then with data being entered. Hit ENTER to submit the entered terms

This specifically was excluded from the widgets of Jsearch because google-like search boxes generally don't appear in sidebars or have standard sidebar headers and footers. So using this requires that you find a place in your template you'd like the box to appear and entering this line:

<?php jsearch_gbox(150); ?>

The 150 is the width I wanted the box to be. You can also set the height by adding it after the width like this jsearch_gbox(150,20). If you leave both blank, it defaults to 100 pixels wide by 17 tall.

This box uses the same code to parse terms as the term input on the jsearch page itself. You can use +, – or quotes just like you can there. Just like a Google box, you hit the ENTER key when done. The page will then open the jsearch page and begin the search.

Multiple Category Checkbox Selector

The very first ever jsearch function makes a return! Use the following code anywhere:

<?php jsearch_catlist();>

And you'll get a list of categories just like the one in WordPress except there will be checkboxes next to them that will let you select multiple categories.

Other types of input are planned for the future, but that's all I could manage for now
Seminars and Guides

Sick of Identity theft?

CLICK HERE

Want to be safe online?

CLICK HERE

Want your privacy back?

CLICK HERE
Work With Jeremy

For:

Seminars

Conferences

Consultation

Private Tutoring

Classes

Click here to
CONTACT JEREMY

Support the Geek

If you hate ads as much as I do, please consider supporting us by donating or browsing our recommended products


Recommended Products and Services
Quick Tips:
IDENTITY THEFT
PRIVACY
INTERNET SAFETY
PASSWORDS