Modify Travelous Slider

Hi again!

If you already use a theme from ColorLabs named Travelous, you have to set a tag into your review in order to displaying it at the slider. And the one that displayed on the slider is the latest reviews you have, you cannot choose what item you want to display at the slider.

At this tutorial, i will show you how to modify the slider so you can choose which review post type you want to display at the slider. At this tutorial, you have to modify 2 files: index.php and theme-options.php.

Step #1

At this step you have to modify a file named theme-options.php. What you have to do in this file is to create an option that allowing to choose. To find out this file

Open the file and find out this code: you can login into your FTP and go to directory: wp-content > themes > travelous > includes.

if ( ( get_post_type() == 'review') || ( !get_post_type() ) ) {

Then put this code just below it:

$colabs_metaboxes[] = array( "name" => "set_slider",
					"label" => "Set as slider item",
					"std" => "false",
					"type" => "checkbox"); 

Once you made it, you can access your add new/edit review and you will have a new checkbox.

Step #2

At this step you have to modify a file named index.php. At this file you have to modify the loop and call the metabox value. Open the file and find out this code:

$slider=get_option('colabs_slider');
		if ($slider=='') $slider=1;
		$query_reviews = new WP_query( array(
			'showposts' => 5,
			'post_type' => 'review',
			'tax_query' => array(
				array(
					'taxonomy' => 'review_category',
					'field' => 'id',
					'terms' => $slider
				)
			)
		));
		if($query_reviews->have_posts()):

Modify the code become:

$slider=get_option('colabs_slider');
		if ($slider=='') $slider=1;
		$query_reviews = new WP_query( array(
			'showposts' => 5,
			'post_type' => 'review',
			'meta_key' => 'set_slider',
			'meta_value' => 'true', 
		));
		if($query_reviews->have_posts()):

And done!

Advertisements

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