Travelous: Review Archive Not Working

Hi everyone!

One of the successful blog theme from Colorlabs is Travelous. If you like to travelling a lot and want to share your story, reviews, etc. about it, this theme will be a perfect partner for you.

This theme using a custom post type for the reviews. By creating a review, you can add a map of the place, type a review and also put a star (rating) into that place.

As you know if you are using a custom post type, you should be able to call the archive page of that post type. For example, if you have a post type named review, you should be able to call all reviews you made by going to this URL: http://www.your-site.com/review. And that is the problem within this theme.

If you are trying to call that path, what you will get is all archive you have (post and review) displayed on one page. And this is wrong.

At this tutorial, i will tell you about how to fix it.

Step #1

At this first step you need duplicate a file by logging in into your FTP. First you need to go to directory: wp-content → themes → travelous. Copy a file named archive.php and duplicate it become: archive-review.php.

If you already did it, your work at this first step already done.

Step #2

At this second step you need to modify a file named theme-functions.php. You can find out this file via FTP at directory: wp-content → themes → travelous → includes.

Open the file, find out and remove this code:

function search_filter($query) {
  if ( !is_admin() && $query->is_main_query() ) {
    if (($query->is_search)||($query->is_archive)) {
      $query->set('post_type', array( 'post', 'review' ) );
    }
  }
}

add_action('pre_get_posts','search_filter');

And done!

Before you are going to test the modification, make sure if you go to WordPress dashboard → Settings → Permalinks. Set the option to post name. And voila! You can visit http://www.your-site.com/review to get all reviews you’ve made.

Advertisements

4 thoughts on “Travelous: Review Archive Not Working

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s