WordPress Search - GreenGeeks https://www.greengeeks.com/tutorials/category/wordpress-search/ How-to Website Tutorials Tue, 23 Apr 2024 15:30:56 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.3 How to Exclude Posts, Pages, Categories or Authors From WordPress Search https://www.greengeeks.com/tutorials/exclude-posts-pages-categories-authors-wordpress-search/ https://www.greengeeks.com/tutorials/exclude-posts-pages-categories-authors-wordpress-search/#comments Tue, 21 May 2019 14:34:18 +0000 https://www.greengeeks.com/tutorials/?post_type=ht_kb&p=25960 In this tutorial, I will show you how to use a plugin to exclude posts, pages, categories or authors from your WordPress search results. When […]

The post How to Exclude Posts, Pages, Categories or Authors From WordPress Search appeared first on GreenGeeks.

]]>
In this tutorial, I will show you how to use a plugin to exclude posts, pages, categories or authors from your WordPress search results.

When you search in WordPress, the results include all of the relevant posts and pages. However, you may have some situations where excluding a post or page, or even an author or category from search results is more ideal.

This article will show you how to do that easily with a WordPress plugin.

If you need to take customization even further, I will also point you to an article that shows you how to edit WordPress files to set search exclusions based on other criteria.

Exclude Posts and Pages From WordPress Search Results

The first step is to install the Search Exclude plugin.

Log in to your WordPress admin panel. In the left side of the WordPress admin panel, mouseover the “Plugins” link and click the “Add New” link.

how to exclude posts or pages from WordPress search step 1

Search for “Search Exclude,” click the “Install Now” button

how to exclude posts or pages from WordPress search step 2

Click the “Activate” button.

how to exclude posts or pages from WordPress search step 3

To Exclude a Post From WordPress Search Results

Go to your list of posts and Click the “Edit” link for the post you would like to exclude.

how to exclude posts or pages from WordPress search step 4

Scroll down to the bottom right of the post. Check the box for “Exclude from Search Results.”

how to exclude posts or pages from WordPress search step 5

Scroll up and click the “Update” button.

how to exclude posts or pages from WordPress search step 6

The post will now be excluded from the WordPress search results.

To Exclude a Page From WordPress Search Results

Excluding a page is done the same way you exclude a post. Go to your list of pages and click the “Edit” link for the post you would like to exclude.

Scroll down to the bottom right of the post. Check the box for “Exclude from Search Results.”

Click the “Update” button.

how to exclude posts or pages from WordPress search step 7

The page will now be excluded from the WordPress search results.

View or Edit the Pages and Posts Excluded From WordPress Search Results

Mouseover the “Settings” link and click the “Search Exclude” link.

how to exclude posts or pages from WordPress search step 8

The list will include posts and pages excluded from WordPress search results.

To stop excluding a post or page, uncheck the box for the post or page and click the “Save Changes” button.

how to exclude posts or pages from WordPress search step 9

That’s a pretty easy method to exclude posts and pages from WordPress search results. What if you want more advanced exclusions? For example, what if you need to exclude a specific category or author from search results? That’s a bit more complicated, but it’s possible with a few lines of code.

To Exclude a Category or Author From WordPress Search Results

There are a couple of different ways to exclude categories or authors from your search results. First, you can edit functions.php, one of the files in your WordPress theme. The other method is to create your own plugin to do the job. Creating a plugin sounds like a difficult task, but it’s pretty easy. Check out our tutorial, How to Create a Custom Site-Specific WordPress Plugin.

The benefit of making your own plugin is the code remains separate from the theme you’re using. So if you change themes, or update an existing theme, your code doesn’t get lost in the process. Of course, you can also protect your changes by creating a child theme, and making your functions.php changes in the child theme.

Whichever way you choose, you always want to avoid editing any theme files directly. If you do that, your changes will be overwritten when the theme is updated.

Excluding Specific Categories From WordPress Search Results

Before we get to the code, let’s look at how to identify a specific category.

Log in to your WordPress admin panel. Mouseover “Posts” and click the “Categories” link.

how to exclude posts or pages from WordPress search step 10

Mouseover the category you want to identify. The category ID is in the URL (in this example, the ID is 5).

how to exclude posts or pages from WordPress search step 11

Now you’re going to add the following code to functions.php. You can do this by using FTP programs like FileZilla by downloading, editing and uploading functions.php from your theme directory.

If you don’t want to use FTP, you can use the WordPress admin panel. Mouseover “Appearance” and click the “Theme Editor” link.

Whichever method you use, be sure to edit the functions.php file in your child theme, not in the main theme directory.

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]function wpb_search_filter( $query ) {
if ( $query->is_search && !is_admin() )
$query->set( ‘cat’,’-5‘ );
return $query;
}
add_filter( ‘pre_get_posts’, ‘wpb_search_filter’ );[/ht_message]

In the code above you will replace “-5″ with the ID for your category. You can exclude multiple categories from the search results by separating the IDs with commas:

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]function wpb_search_filter( $query ) {
if ( $query->is_search && !is_admin() )
$query->set( ‘cat’,’-5, -7, -10‘ );
return $query;
}
add_filter( ‘pre_get_posts’, ‘wpb_search_filter’ );[/ht_message]

Excluding Specific Authors From WordPress Search Results

Excluding authors is done in the same way we excluded categories. First, identify the author ID.

Mouseover “Users” and click the “All Users” link.

how to exclude posts or pages from WordPress search step 12

Mouseover the author you want to identify. The author ID is in the URL (in this example, the ID is 8).

how to exclude posts or pages from WordPress search step 13

Then add the following code to functions.php:

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]function wpb_search_filter( $query ) {
if ( $query->is_search && !is_admin() )
$query->set( ‘author’,’-8‘ );
return $query;
}
add_filter( ‘pre_get_posts’, ‘wpb_search_filter’ );
[/ht_message]

In the code above you will replace “-8″ with the ID for the specific author you wish to exclude. You can exclude multiple authors from the search results by separating the IDs with commas:

[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]function wpb_search_filter( $query ) {
if ( $query->is_search && !is_admin() )
$query->set( ‘author’,’-8, -6, -4‘ );
return $query;
}
add_filter( ‘pre_get_posts’, ‘wpb_search_filter’ );
[/ht_message]

That’s All There Is to It

Now you know how to use a plugin to exclude posts or pages from your WordPress search results, as well as the code necessary to exclude categories or authors.

I hope you find these new tools helpful in customizing and fine-tuning your WordPress installation.

How many customizations do you use with WordPress? Do you prefer using plugins or adding code to theme files?

The post How to Exclude Posts, Pages, Categories or Authors From WordPress Search appeared first on GreenGeeks.

]]>
https://www.greengeeks.com/tutorials/exclude-posts-pages-categories-authors-wordpress-search/feed/ 2
How to Show Specific Post Types for Search Results in WordPress https://www.greengeeks.com/tutorials/show-specific-post-types-for-search-results-in-wordpress/ https://www.greengeeks.com/tutorials/show-specific-post-types-for-search-results-in-wordpress/#respond Mon, 29 Apr 2019 15:00:48 +0000 https://www.greengeeks.com/tutorials/?post_type=ht_kb&p=25272 Although WordPress has a basic method to let users search your site, it doesn’t always provide the best results. If you can fine-tune the tool, […]

The post How to Show Specific Post Types for Search Results in WordPress appeared first on GreenGeeks.

]]>
Although WordPress has a basic method to let users search your site, it doesn’t always provide the best results. If you can fine-tune the tool, it could improve engagement and on-page time of the site. And showing specific post types in search is a good way to accomplish this.

After all, you want visitors to find exactly what they’re looking for if you want to keep them interested.

Today, I’ll show you how to add specific post types for search results in WordPress.

Why Showing Specific Post Types in Search Matters

By default, the search function of WordPress is not as intuitive as many may like. It doesn’t always provide the best results according to visitor criteria. Not to mention that you don’t have options for customizing the results.

When you expand what the search function can do, you deliver a more engaging layout for visitors.

For instance, it’s easy to build a WordPress custom search page where visitors can find more precise results. This has the potential to keep them browsing your content longer instead of looking elsewhere for answers.

Of course, you still need to create amazing content for those search functions to work properly.

Using Ivory Search

In this tutorial, I am going to demonstrate a bit of what Ivory Search can do in WordPress. It’s a solid plugin that comes with an easy-to-use interface. This plugin lets you customize results according to specific post types in search.

You can add it in the sidebar, on a post, page or even add a search in the menu bar.

You can limit authors, custom post types, metadata and even adjust for WooCommerce should you open an online store.

In a nutshell, it lets you build a WordPress custom search form while giving a lot of options for specific information.

Install and activate, “Ivory Search.”

Ivory Search

Upon activation, you’ll see a security and updates feature display. This is an optional setting, and you don’t have to allow the function.

Essentially, it’s the developer asking permission to send you update information regarding features and security.

Choose which option you prefer. For this tutorial, I’m simply clicking the “Skip” button. But this is completely up to you.

Choose Option

The next screen will show “Search Forms.” You can find this later by going to “Ivory Search” from the left panel in WordPress.

In this screen, you will see all of your available search forms. As you can create multiple search results for your site, here is where you would make adjustments.

Ivory search gives you a variety of ways to improve the searchability of your website. You can use widgets, create a specific search page or use a simple field in the navigation menu.

Adding New Search Results

Let’s build a new search form.

Click the “Add New” button on the top of the screen.

Add New Search

Give the search form a new name. This is for your reference only. Visitors will not see this display on the front end.

New Search Form Name

Select the options you want to enable for this search form. Here is where you can adjust specific post types in search results.

Specific Post Types Search Form

For example, you can enable “Attachment” under Post Types if you want visitors to search through images and files.

Enable Attachment Search

Something like this might benefit an online portfolio or a way to search image galleries.

Another method to fine-tune the WordPress search results page is to use the Category & Taxonomy Terms. In this section, you can select specific categories, tags and post formats. You can also include titles and descriptions.

Select Specific Category

This gives you a great way to let WordPress search within a category of your choice. Which means you can offer a custom search form in posts which only browse related content.

Unfortunately, a lot of Ivory Search’s more engaging options are locked behind the pro version. For example, you can limit search results according to author unless you upgrade.

Once you’re done making your adjustments, click the “Save Form” button.

Save Search Form

Excluding Search Results

What if you want to exclude specific post types in search?

Click the “Excludes” tab on the left of the search form.

Exclude Custom Search

This section works the same way as when you’re building your new search form. However, it will remove these options from the results page. Select the search criteria you want to avoid in the new search field.

Ignore Search Criteria

For example, we could choose to remove a tag by selecting it from the list.

Remove Tag From Search

Once you’ve selected your options, click the “Save From” button.

Save Search Excludes

Using Custom Search on a Post or Page

Now that we have a specific post types search ready, it’s time to add it to a page or post.

Click “Search Forms” under the Ivory Search tool on the left.

Search Forms

Copy the shortcode of the search form you want to use.

Search Form Shortcode

Paste the shortcode into any post or page you want to use the search field.

Paste Search Shortcode

If you’re using the Gutenberg Editor, you can use a shortcode block for this as well.

Once the post or page is published or updated, you’ll see the search field available.

Search Field Available

This lets you place the search field anywhere within your content.

Using a Custom WordPress Search Widget

What if you want a WordPress custom search form in a widget? Ivory Search can do that as well. This lets you put the search function in any sidebar of your theme.

Go to Appearance and click, “Widgets.”

WordPress Widgets

Drag and drop the “Ivory Search” widget into your sidebar.

Drop Search Widget

Choose which search from you want to use.

Choose Search Form

Click the “Save” button on the widget.

Save Search Widget

You will then have a search field in the sidebar in reference to the custom search query settings of the form you built.

Improve On-Page Time with Specific Post Types Search Results

Adding a WordPress custom search form improves your control over the results. It also gives you a chance to offer visitors a way to search specific post types. Offer your guests an easier way to browse your content. It may boost overall engagement of the site.

What search tools do you like to use in WordPress? Do you find visitors looking for certain information through your posts or pages?

The post How to Show Specific Post Types for Search Results in WordPress appeared first on GreenGeeks.

]]>
https://www.greengeeks.com/tutorials/show-specific-post-types-for-search-results-in-wordpress/feed/ 0
How to Add Search in the Menu Bar of WordPress https://www.greengeeks.com/tutorials/add-search-in-the-menu-bar-of-wordpress/ https://www.greengeeks.com/tutorials/add-search-in-the-menu-bar-of-wordpress/#respond Mon, 18 Mar 2019 15:00:35 +0000 https://www.greengeeks.com/tutorials/?post_type=ht_kb&p=24386 A search function can help visitors find exactly what they’re looking for on the website. This is especially useful if you have a lot of […]

The post How to Add Search in the Menu Bar of WordPress appeared first on GreenGeeks.

]]>
A search function can help visitors find exactly what they’re looking for on the website. This is especially useful if you have a lot of content available. While the system has a default ability built-in, what if you want to add search to the menu bar of WordPress?

For example, what if your theme doesn’t use a sidebar? Perhaps you want to move the search field to streamline the site’s layout.

Something else to consider is how your site appears on mobile devices. As most themes shift the sidebar down, visitors using smartphones may not even see a search widget for the website.

Adding it to the top nav menu makes search easier to find for mobile users.

In this tutorial, I’ll show you how to add search to the menu bar in WordPress. This also helps if you want to create a custom nav menu on the website.

Using the Ivory Search Plugin

Today, I’m going to show you a bit of the Ivory Search plugin. It’s an easy tool to use and comes with a variety of options.

For instance, you can quickly create a WordPress search widget for the sidebar as well as add it to the navigation menu. It also supports WooCommerce for those who want to build an online store.

Install and activate the “Ivory Search” plugin.

Ivory Search

Upon activation, you’ll see an update notification appear. This is a security feature that is purely optional. You can choose to allow or skip the notifications.

Allow Notifications

For this tutorial, I’m going to click “Skip” to continue. Because the plugin is added to a temporary site, I really don’t need to worry too much about opting into this feature.

Once you choose the notification option, you’ll be taken to the Ivory Search form screen. By default, the plugin will create a basic form for you.

It is here where you can copy the shortcode of the search field and paste it into any post or page if you’d like.

For now, we’re using Ivory Search to add to a menu.

Click the link for “Settings” under the Ivory Search tool on the left admin screen of WordPress.

Ivory Search Settings

The plugin will find the menus you have active on your website. Click the switch to activate the menu search bar under “Select Menu.”

Activate Search

From here, you can also change some of the options for the search field such as form style, menu title, classes and activating the closing icon for search. These are optional depending on how you want the field to operate.

When you’re done with adjustments, click the “Save” button on the bottom.

Save Search Settings

You now have a search field in your menu bar.

Search Menu Nav Bar

NOTE: If you have a search widget for the Website, you might want to remove the feature. It may seem redundant to your visitors if there are two search fields close together on the site.

Two Search Fields

There’s nothing wrong with having multiple search bars available. But it’s probably more aesthetically pleasing to simply have the one.

Other Plugins to Try

While this tool is an easy way to add search to a menu in WordPress, the plugin isn’t the only one available. In fact, there are several that you might want to consider if you’re looking for different options.

Here are just a couple of the ones I found that might be of help.

Max Mega Menu

Max Mega Menu

Max Mega Menu has a lot of customizable options available especially if you buy the pro version of the plugin. While it’s more of an editing system for menus, it does come with the ability to add a search box.

It’s an exceptionally popular tool and has a lot of elements for creating custom menus in WordPress.

WP Mega Menu

WP Mega Menu

WP Mega Menu is another plugin that is more focused on customizing a nav bar. However, it also supports adding searching in the menu as well as a lot of other features.

This tool has several customizable features and supports mobile devices, Google Fonts, and various social icons. It’s a great way to add more to the nav menu aside from your search field.

Making Search Easier on Guests

Although a search widget for the website in the sidebar is helpful, adding it to your menu makes it easier for visitors regardless of the device they use. From aesthetics to functionality, consider the possibilities with a search nav menu item.

What kinds of pages, links or features do you use on your navigation menu? Do you find custom search options to be a valuable asset to your site?

The post How to Add Search in the Menu Bar of WordPress appeared first on GreenGeeks.

]]>
https://www.greengeeks.com/tutorials/add-search-in-the-menu-bar-of-wordpress/feed/ 0
How to Exclude Posts or Pages from WordPress Website Search https://www.greengeeks.com/tutorials/exclude-certain-pages-from-your-wordpress-website-search/ https://www.greengeeks.com/tutorials/exclude-certain-pages-from-your-wordpress-website-search/#comments Sun, 13 Jan 2019 16:00:50 +0000 https://www.greengeeks.com/tutorials/?post_type=ht_kb&p=23013 When you are searching WordPress, by default, the WordPress search displays all published posts and pages within the site that are relevant to your search. […]

The post How to Exclude Posts or Pages from WordPress Website Search appeared first on GreenGeeks.

]]>
When you are searching WordPress, by default, the WordPress search displays all published posts and pages within the site that are relevant to your search. However, when users are using the WordPress search function, more often than not, they are looking for a particular post and not a page on the site.

In this tutorial, I will demonstrate two straightforward ways to exclude posts or pages from WordPress search results. We will use the plugin technique, and we will also go over how to easily add some code into your functions.php file that will allow you to exclude WordPress posts or pages automatically when someone is performing a search on your website.

Why Exclude Posts or Pages From Search?

There are actually a number of reasons why you may want to exclude posts or pages from a WordPress website search.

Here are a couple of the main reasons:

  • You are publishing a private post or private page content for specific users, and you don’t want everyone to be able to find this content on your website.
  • The site includes paid content that shouldn’t be accessible to users who don’t have permission to view it.
  • You are trying to avoid irrelevant pages from showing up in search results on your site. A good example of this is the Homepage or Author Page showing up in results. Pages like those are usually not going to be relevant to a visitor’s search.

Basically, when you exclude posts and pages in WordPress search, you are allowing people to find relevant content faster and easier. It is not difficult to accomplish these changes.

Let’s take a look at how easily we can exclude posts or pages from a WordPress website search.

Exclude Posts or Pages from WordPress Search Using a Plugin

In order to exclude posts or pages form a WordPress website search using the plugin method, we are going to use the Search Exclude plugin.

Search exclude plugin

Search Exclude is a lightweight, simple-to-use plugin. It allows you to quickly and easily exclude any posts or pages from a blog search in WordPress.

The plugin has no settings to configure.

Essentially, it adds a new feature to the editing screen for posts and pages. You simply install and activate the plugin, and you can exclude pages by checking the checkbox that now appears within posts and pages.

Search Exclude also provides you with a “settings” page area that will list all the posts and pages you have excluded from the search. This way, you can easily find what you are looking for without going through all your posts or pages one-by-one.

Note: This plugin does support quick and bulk edit. It will also not affect your SEO in any way. Your sitemap will still include the pages or posts that you exclude from search.

Install and Activate Search Exclude

In order to use the Search Exclude plugin, it needs to be installed and activated. You can do this from the plugins page of your WordPress admin dashboard. Simply search for the plugin.

INstall and activate exclude posts and pages from wordpress website search plugin

Once you have located the plugin, click the “Install Now” button, then click the “Activate” button.

Once the plugin has been installed and activated, open any post or page in the editor. You will see that a new checkbox appears on the right side of the editor titled “Search Exclude.”

To exclude a post or page from a WordPress search results page, simply check the relevant box and then publish or update the content. Now the post or page will be excluded from the search results on your WordPress site.

Exclude posts or pages from wordpress search box

To see a list of all the posts and pages you have excluded over time, click on Settings > Search Exclude.

Click settings and then search exclude

Now you see a list of all the posts and pages you have excluded from your WordPress website search. This is an easy way to track and see everything you have done.

For example, maybe you see a sharp drop in traffic of a post that you wanted to remain within the site search. You can look in this list to ensure it wasn’t accidentally added.

List of posts and pages excluded from wordpress website search

Adding Code to Functions.php File to Exclude Posts or Pages

You can also remove posts or pages from your blog search in WordPress by adding some code to the functions.php file.

Note: If you edit your theme’s functions.php file, you run the risk that your changes will be overwritten when the theme updates. For that reason, it’s always best to use and edit a child theme whenever you plan to make changes to theme files.

To get to your website’s functions.php, file click on Appearance > Editor.

Click on appearance and then editor to access functions.php file

This will take you to the WordPress website files where you can edit your code. Click on “Theme Functions (functions.php),” and you will be ready to place the correct code to exclude WordPress pages.

Click on theme functions (functions.php) to edit code

Place the following code into your theme’s functions.php file:

//Alter the WordPress search to return ONLY posts, no pages
if (!is_admin()) {
  function search_filter_posts($query) {
    if ($query->is_search) {
  $query->set('post_type', 'post');
}
  return $query;
}
  add_filter('pre_get_posts','search_filter_posts');
}

What Does The Code Do?

Simply put, the code above checks to make sure that the WordPress search is not originating from any of the WordPress admin pages. Once it verifies that it isn’t, then the code forces searches for posts only by setting the post_type parameter and will exclude WordPress pages.

If you would like to do the opposite, force the WordPress search results page to show only pages, set the post_type parameter to “page.”

//Alter the WordPress search to return ONLY pages, no posts
if (!is_admin()) {
  function search_filter_pages($query) {
    if ($query->is_search) {
  $query->set('post_type', 'page');
}
  return $query;
}
  add_filter('pre_get_posts','search_filter_pages');
}

The Effects of Removing Something From Search Results

Private content or paid content isn’t generally part of your site statistics or analytics, so removing them from search won’t have a negative impact. On the other hand, removing a page or post from your onsite search results is likely to cause a drop in viewership.

That’s to be expected, but as I mentioned earlier, your sitemap should still contain the pages you exclude from search. So if your SEO game is strong, the effect of removing a page (or all pages) from search shouldn’t be overly negative.

Just remember that you are reducing the visibility of anything you exclude from search. So it’s a good idea to revisit your statistics or analytics a few weeks or months after making any exclusions.

Final Thoughts

Regardless of your reasons for wanting to remove something from search, the flexibility of WordPress makes it easy to do. Plugins are there for ease and speed, and template or file modifications for those who prefer to dig into the works.

That’s why we covered both methods in this tutorial. One method is not necessarily better than the other, it’s just a matter of your preference and experience level.

In addition to what we’ve talked about here, there is also a great option to tell your WordPress site to use more search engines when performing a search on the site. I hope this tutorial gave you a little insight into how easy it is to exclude posts or pages from WordPress website search.

Have you used the above plugin technique or code before? What is your preferred method of improving search functionality on your WordPress website?

The post How to Exclude Posts or Pages from WordPress Website Search appeared first on GreenGeeks.

]]>
https://www.greengeeks.com/tutorials/exclude-certain-pages-from-your-wordpress-website-search/feed/ 1
How to Add a Search Bar to WordPress Using Shortcode https://www.greengeeks.com/tutorials/search-bar-wordpress-shortcode/ https://www.greengeeks.com/tutorials/search-bar-wordpress-shortcode/#comments Wed, 16 May 2018 14:00:03 +0000 https://www.greengeeks.com/tutorials/?post_type=ht_kb&p=18660 As your site grows, it becomes harder and harder to find what you are looking for as a visitor. While good navigation menus can help, […]

The post How to Add a Search Bar to WordPress Using Shortcode appeared first on GreenGeeks.

]]>
As your site grows, it becomes harder and harder to find what you are looking for as a visitor. While good navigation menus can help, adding a WordPress search bar can be the best solution and luckily, there are several ways to add one.

A search bar can help users quickly find what they are looking for and can oftentimes be more accessible than a navigation menu. The value of a search bar depends on the amount of content your site has.

The older the website, the more valuable the search bar becomes.

Today, I will show several methods that you can use to add a search bar in WordPress.

Why Add a Search Bar in WordPress?

A search bar serves a very obvious purpose, to help visitors find what they are looking for.

Without a search bar in place, the only option a visitor has is to utilize the other navigation systems. While a streamlined navigation system will get you very far, it is not enough when your website reaches a certain size.

For example, imagine a site that has over 1,000 blog posts. If you want to find a post from 2 years ago, you are going to have a really hard time finding it if you cannot search for the title.

A user would have a better shot of finding it if they typed the title and your site name into Google.

Another consideration would be something like an FAQ section for your site. Users can enter their questions into the search field and potentially find the answer to that question. This can help them avoid having to call or send an email.

Since your goal should be to keep visitors on your site and make their experience as simple as possible, a search bar is a great addition to any site. Luckily, there are several ways to add one in WordPress.

Method 1: Using the Search Block

The Gutenberg editor comes with a variety of blocks that site owners can use to add features, and sure enough, there is a dedicated Search block to add a search bar in WordPress.

This block can be placed on any post, page, or even in a widget area. It is very simple in terms of functionality and creates a site-wide search. It is not as robust as a dedicated plugin, but it works well on simple blog sites.

Start by going to the area of WordPress you want to add the block to. In this case, I will just go to a post. Once there, click on the “+” button and search for the Search block. Add it to the post.

Search

The search bar will appear in that post, page, or widget area. Its appearance is based entirely on your theme, thus yours may look different from mine. If you are comfortable with coding, you can customize the appearance by editing your theme.

Search Bar

While you cannot edit the appearance, you can adjust a few settings. For example, you can create your own placeholder text like “Search…” and can customize the text of the “Search” button. To edit these fields, just click on them and replace the text.

You can also use the block settings to alter the size of the search bar. Or more specifically, the width.

Search Bar Width

And that covers everything you need to know about the Search block in WordPress. Again, the search functionality is very limited. For more options and fine-tuned search results, you will want a dedicated plugin.

Method 2: Ivory Search Plugin

The second method we will look at is using the Ivory Search plugin. This plugin offers websites an advanced search functionality that can be customized by creating your own search forms. This can help you limit what appears in searches.

That said, just the default options will be enough for most sites. Thus, it doesn’t need to get complicated.

Placing the search bar in WordPress is very simple as the plugin generates a shortcode for you after making the search form. Simply add the shortcode and the search bar will appear in that location.

Step 1: Install Ivory Search

Let’s start by clicking on Plugins and selecting the Add New option on the left-hand admin panel.

Add New

Search for Ivory Search in the available search box. This will pull up additional plugins that you may find helpful.

Ivory Search

Find the Ivory Search plugin and click on the “Install Now” button and activate the plugin for use.

Install Now

Upon activation, the plugin will ask if you want to receive email notifications about the plugin. Feel free to skip or accept as it does not affect using the plugin.

Step 2: Search Forms

By default, the plugin is ready for use, and you can add a search bar anywhere in WordPress with the proper shortcode. That said, it is possible to customize the search functionality of this plugin by editing a search form or making a new one.

While this may sound very complicated, you are just using a series of switches to decide what content appears in a search and what doesn’t. Again, the default search will work well for most sites, but the choice is yours.

If you want to test the default search first, feel free to skip to step 3 to add the shortcode to make the search bar appear in WordPress.

Otherwise, click on Ivory Search and select the Search Forms option.

Ivory Search

By default, the plugin provides four search forms. You can edit any of them as you see fit. In this case, I will just edit the Custom Search Form, but the process is the same no matter which one you select, or if you create a new one.

Once inside, you will see the content that users can see. This includes Posts, Pages, and Media types. So, if I click on Pages, there are two options. The first is to search all pages, and the second is to search from specific pages.

Activate the switch to search from specific pages.

Specific pages to search from

You can hold down the Control or Command button to highlight the pages that you want the plugin to search from. In this, case, I selected everything except my Homepage.

Choose Pages

This process is the same for posts. Media types are locked behind the Pro version, but if you purchase it, you can ignore content types like images, videos, and so on. Click on the “Save Form” button at the bottom after configuring the search form.

Step 3: Add the Search Bar in WordPress Using Shortcode

Now that the search form has been modified, or if you just want to use the default option, it is time to add the search bar in WordPress using the shortcode. Luckily, this is pretty easy.

First, to find the shortcodes, we simply need to revisit the search Forms area. You will see the shortcode next to the search form it is for.

Search bar shortcode for WordPress

With the shortcode copied, go to any post, page, or widget area that you wish to add the search bar to in WordPress. Once there, just add a Shortcode block and paste the shortcode inside of it. Save the changes and view it on your website.

Search Bar in WordPress with Shortcode

And that’s all there is to it. Be sure to test out the search functionality. You can tweak the search form if needed at any time.

Make Sure Visitors Can Find What They Are Looking For

The entire point of adding a search bar is to help visitors find what they are looking for. Not having one can be disastrous for your website. Imagine trying to navigate Amazon without being able to search for an item.

It just isn’t going to work very well.

Luckily, it is really easy to add a search bar in WordPress. The two methods above showcase exactly how to do it, but just be aware that there are more methods and alternative plugins you can use.

I hope you found this tutorial helpful in learning how to add a search bar in WordPress.

Which method did you use to add a search bar in WordPress? Did you use a different search bar plugin?

The post How to Add a Search Bar to WordPress Using Shortcode appeared first on GreenGeeks.

]]>
https://www.greengeeks.com/tutorials/search-bar-wordpress-shortcode/feed/ 3
How to Use the Best WordPress Search Engines on Your Site https://www.greengeeks.com/tutorials/how-to-use-the-best-wordpress-search-engines-on-your-site/ https://www.greengeeks.com/tutorials/how-to-use-the-best-wordpress-search-engines-on-your-site/#comments Wed, 05 Apr 2017 14:00:04 +0000 https://www.greengeeks.com/kb/?p=10232 Google and Bing are not the only ways people can search for relevant content. Many will use the search bar on your website to find […]

The post How to Use the Best WordPress Search Engines on Your Site appeared first on GreenGeeks.

]]>
Google and Bing are not the only ways people can search for relevant content. Many will use the search bar on your website to find materials. However, not all searches pull up good results or an attractive appearance. This has potential to hinder the performance of your site from the human perspective.

Luckily, there is a way you can add the best WordPress search methods. This can also be done without programming knowledge or creating your own extensive algorithms. With a few selections in settings, the search bar can turn into one of the most important areas of your website.

In this tutorial, I’m going to show you how to use the best search engine alternatives for your WordPress website. After all, giving visitors an easier way to find what they’re looking for only serves to benefit you in the long run.

Why revamp the search method on the site?

While the default searching ability of WordPress is useful, it lacks some of the capabilities many people have come to enjoy. For one, the autocomplete feature can be quite handy when trying to find content before hitting the enter button.

Another thing to consider is that some search methods are severely lacking when it comes to finding specifics. For example, some plugins that will look amazing pale in comparison to when someone uses the “site:” command in Google. I’ll explain this capability later.

It’s all about giving people what they are looking for as quickly as possible. If someone has to spend too much time trying to refine their search because it’s not matching with results, they’ll lose interest in the site rather quickly. While it may not be the worst design addition to a website, it still has potential to be a hindrance.

Giving the search bar a more elegant and efficient display can also boost visitor retention. People enjoy interaction and having more of an “experience” when visiting a site than just merely viewing text on a screen. This is why many developers are putting in more interactive elements into designs and content.

Using the SearchIQ Plugin

The Search function in WordPress gives visitors a useful tool. However, you can take it a step further and receive detailed metrics about how they use it. searchIQ has that capability. Although this plugin does offer a free version, the “pro” upgrade expands what you can do.

Other features of searchIQ include cross-domain searching, autocomplete fields, real-time analytic data and a sleek thumbnail display to show the content of your site in results. This plugin requires the use of an account in searchIQ’s website, but the starter account is free.

To use searchIQ:

Go to the website for searchIQ and create a free account.

search iq website

Go to the plugins area of WordPress, click “Add New” and search for searchIQ.

find search iq

Install and activate the plugin. This will add a new function to the left admin panel in WordPress called, “searchIQ.”

activate search iq

Click into this link. Here is where you enter the API key from your searchIQ account.

api key

Once the API key is inserted, click the submit button to save the settings.

api submit

The next step from this plugin is to synchronize your posts. This gives you an option of what kind of content you want to add to the database for searching. For example, posts, pages, custom CSS files, feedback, FAQ plugins and more can all be added with a click of the corresponding check box. Once you make the selections for what to include, click the “Synchronize Posts” button.

synchronize posts

A progress bar will appear and show you when searchIQ has finished indexing your site.

progress bar

Click the options tab. From here, you can make a variety of changes depending on how you want the search bar to behave. Autocomplete, setting up a static page in WordPress for results and the search algorithm can all be adjusted. Click “Save” when you’re ready to continue.

option tab

Click the tab for the Results Page. In this section, you have a great deal of customizing control that lets you alter labels, colors, number of results and more. You’re even provided with a preview window to show what your changes will look like on the site. Click the button to submit your changes when you’re done.

result page

Click the Autocomplete tab. Here, you can alter how the autocomplete feature appears when someone searches for a topic. Click the button to submit changes if you’ve made any.

autocomplete tab

Click the Mobile tab. The searchIQ plugin is optimized for mobile users. Here, you can make changes to how the plugin behaves for smartphones and tablets. Unfortunately, this section doesn’t have a preview window like the others.

mobile tab

Go to the widgets area in WordPress located under, “Appearance.”

widgets

Locate the “searchIQ search box” widget and drag it over to your sidebar.

drag search iq to sidebar

From here, you can change the default text that shows in the box before users begin typing. Otherwise, simply click save.

click save

Now, your website will use the abilities and features of searchIQ. You will have to access the plugin’s website directly if you wish to view statistics regarding how your new tool is working for visitors.

Other Plugins to Add Engagement to Searching

Alogolia

alogolia

Algolia is another third-party engine requiring an account to activate it. Like the one I featured above, this plugin also has a free account. It can handle up to 10,000 records and allows for 100,000 requests from website users. It is similar to searchIQ in almost every way but fewer customization options.

WPSolr

wpsolr

WPSolr is a bit more convoluted when it comes to controls. However, this also means there is great possibility for customization. While the free version does offer some great capabilities for search, the premium services include integrations with various eCommerce plugins and other tools for WordPress.

Search & Filter

search and filter

The Search & Filter plugin is more of an extension to the WordPress system already in place. I mention it in this tutorial because it expands what can be done through the basic function. You can add custom fields, templates and uses a drag-and-drop editing system. One of its endearing features is the ability to work with WooCommerce and WP eCommerce for those setting up an online store.

Ok, so what is the “site:” command in Google?

When searching for content, a lot of people simply put in the keyword and cross their fingers. What if you want to find content and a specific website? This is when you would use the “site:” ability. It looks like this:

site:greengeeks.com WordPress

This command will search GreenGeeks.com for every instance of WordPress using its famous algorithm for discovering quality content. When you install some of the best WordPress search plugins, compare the results to using the above command on your site. Of course, you want to replace the domain and keyword with your own.

Alternatively, you can incorporate a Google custom search in WordPress to have the most popular engine in the world work for you.

More than a search feature…

You don’t have to be limited to the default search abilities of WordPress to accentuate the site. There are many ways you can add the best WordPress search ability without being a programmer. Give your visitors the interactive experience they crave and make your content easier to find. It may just convince someone to add your site to their bookmarks.

What kind of additions have you added to WordPress to engage your users? Is your site easy to use when it comes to looking for specific content?

The post How to Use the Best WordPress Search Engines on Your Site appeared first on GreenGeeks.

]]>
https://www.greengeeks.com/tutorials/how-to-use-the-best-wordpress-search-engines-on-your-site/feed/ 2