Google analytics is no loger working with WooCommerce out of the box

Recently I updated WooCommerce site from version 2.0.* to 2.1.* and today I noticed that the site stats from Google Analytics are no longer working.

I went to the settigns page and noticed that the Integration tab where the google analytics ID was suposed to be was gone.

Turns out that they dropped the Google integration out of the box in the new release and decided to put it as a separate plugin. The stupid thing is that it was not mentioned in the change log for the WooCommerce itself.

I’m getting a bit disapointed with the way WooThemes handle the most popular eCommerce WordPress plugin. Looks like not very professional approach.

WordPress Empty Search Template

WordPress provides you with a nice and easy way to style the search page template using the search.php in your theme. However there is something that is relatively strange related to the searches in WordPress.

If somebody hits the search button without having the search field filled in it gives you the blog archieve template using the index.php. (this is when openinig

Solution to this problem is just to tell wordpress that it’s a search (so is_search becomes true) if the s parameter is set but is empty. This should happen on a hook before the posts are requested.

So in your functions.php you can simply put this code

/* Fix for empty search redirect to index.php */
function shtrakeu_fix_empty_search ($query){
  global $wp_query;
  if (isset($_GET['s']) && empty($_GET['s'])){
  return $query;

Cheers and follow me on twitter @ninarski

How to make your slider have multilingual support using qtranslate

If you have a multilingual site with slider which uses the featured images for slider images and you want to make it support different slide images depending on the language you might want to follow these simple steps (or you can hack it your way).

Problem one: WordPress doesn’t support multiple featured images.


  1. Get and install this plugin
  2. Add the following code to your theme (functions.php would be okay)
if (class_exists('MultiPostThumbnails')) {
  $type = 'slides_options';

  $thumb = new MultiPostThumbnails(array(
    'label' => 'Secondary Image',
    'id' => 'secondary-image',
    'post_type' => $type
add_image_size('nivo-secondary-image-thumbnail', 960, $nivo_h, true );

Here slides_options is the Custom Post Type which we use for the slider. If you’re not using custom post type for this you can simply change it to ‘post’.

Congrats! Your theme now supports multiple featured images. Hooray!

Now we have to make WordPress display the relevant image for the specific language.

For this purpose we use a function which determines if the default language of qtranslate is used or not and depending on this shows the featured or the secondary image.

function qtranslate_slide() {

 global $post, $q_config;

 $image_id = get_post_thumbnail_id();
 $language = qtrans_getLanguage();
 $upload_dir = wp_upload_dir();
 $image_data = wp_get_attachment_metadata($image_id);
 if ($q_config['default_language'] != $language) {
 if (class_exists('MultiPostThumbnails') && MultiPostThumbnails::has_post_thumbnail('slides_options', 'secondary-image')) :
 MultiPostThumbnails::the_post_thumbnail('slides_options', 'secondary-image', NULL, 'nivo-secondary-image-thumbnail');
 else {
   if (file_exists($upload_dir['basedir'].'/'.$image_data['file'])) {
   $image_url = wp_get_attachment_image_src($image_id,'full', true);
   return $image_url;

Now we have to change in our code where we display the images for the slider

$thumbnail = wp_get_attachment_image_src(some, arguments, here);

with our function

$thumbnail = qtranslate_slide();

And from now on we can use $thumbnail[0] as url for the relevant language, depending on the chosen language

Simple as this! Good luck!

P.S.: feel free to ask me something about that on twitter – 

!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);;js.src=”//”;fjs.parentNode.insertBefore(js,fjs);}}(document,”script”,”twitter-wjs”);