Featured Content Gallery | WordPress Plugin | iePlexus

Getting it to work with WPML Translation

New releases, ideas for the future, and known issues

Getting it to work with WPML Translation

PostBy SwitzerBaden on Mon May 17, 2010 6:21 am

I just spent the last hour figuring out how to hack the featured content gallery (fcg) plug-in to work with WPML and wanted to share how I got it working at http://www.twinpictures.de

Step 1: Insert this function into the theme functions.php file
Code: Select all
function lang_category_id($id){
  if(function_exists('icl_object_id')) {
    return icl_object_id($id,'category',true);
  } else {
    return $id;
  }
}


Step 2: in the featured-content-gallery/gallery.php file, replace this:
Code: Select all
query_posts('category_name=' . get_option('gallery-category') . '&showposts=' . get_option('gallery-items'));

with this:
Code: Select all
$trans_cat = lang_category_id( get_cat_id( get_option( 'gallery-category' ) ) );
query_posts('cat=' . $trans_cat . '&showposts=' . get_option('gallery-items'));


What changed:
The fcg plugin was grabbing all posts from whatever you set as the 'gallery-category' by Name.
now, we take that gallery name, find the gallery ID, find the translated gallery ID (if there is one) and then grab all posts from that Category ID.

Hope this saves someone time figuring this out.
-SwitzerBaden
SwitzerBaden
 
Posts: 1
Joined: Mon May 17, 2010 6:07 am

Re: Getting it to work with WPML Translation

Thank you for using the Featured Content Gallery Forum
 

Re: Getting it to work with WPML Translation

PostBy adiaz on Fri Jun 04, 2010 2:36 am

Hi all,

The Step 2 was failing to me so I changed it into:

Code: Select all
$trans_cat = lang_category_id( get_cat_id( get_option( 'gallery-category' ) ) );
query_posts('category_id=' . $trans_cat . '&showposts=' . get_option('gallery-items'));

The diference is in the second line: 'category_id=' instead of 'cat='.

Hope this helps. ;)
adiaz
 
Posts: 1
Joined: Fri Jun 04, 2010 2:30 am

Re: Getting it to work with WPML Translation

PostBy aiwe on Mon Oct 18, 2010 10:52 am

Hi, thank you for this hack. Can you please tell me how to make WPML translate "Featured Content" button which opens drawer with thumbnails? I'm building site with 3 languages and only this inscription remains the same. Adding something like
Code: Select all
textShowCarousel: '<? _e(); ?>',
in jd.gallery.js.php doesn't work, thoug it works with gallery.php where WPML succesfully translates tooltip on links.
aiwe
 
Posts: 1
Joined: Mon Oct 18, 2010 10:44 am

Re: Getting it to work with WPML Translation

PostBy fsabbagh on Tue Jun 28, 2011 12:27 pm

This was a huge help for me
Thank you
http://www.dayvision.com
fsabbagh
 
Posts: 1
Joined: Tue Jun 28, 2011 12:16 pm


Return to Development, Improvement, and Conflicts

Who is online

Users browsing this forum: No registered users and 0 guests

cron