GTranslate breaks with different wp-content URL

Popular automatic website translation tool

GTranslate breaks with different wp-content URL

Postby tuyre » Sun Apr 10, 2016 1:38 pm

Hello

Potentially a great theme for me to use. I am using Worpress, and have included the widget next to the main menu to display a drop-down menu. The flags next to the languages do not show. I used Google Chrome console (F12) to see what was causing the problem.

I get the following errors show in the console:

Code: Select all
GET https://www.mydomain.com/wp-content/plugins/gtranslate/gtranslate-style16.css?ver=4.4.2 404 ()
(index):109 GET https://www.mydomain.com/wp-content/plugins/gtranslate/blank.png 404 ()
(index):151 GET https://www.mydomain.com/wp-content/plugins/gtranslate/arrow_down.png 404 ()
(index):151 GET https://www.mydomain.com/wp-content/plugins/gtranslate/switcher.png 404 ()
(index):189 GET https://www.mydomain.com/wp-content/plugins/gtranslate/16.png 404 ()


I noticed that the plugin points to the standard wp-content directory, however, I use the security plugin iThemes Security, and this gives the option to change the wp-content directory to something else. Mine is something else of course, lets say wpcontent for the purposes of this post. Given that, I manually changed all instances I found of wp-content in the gtranslate folder to wpcontent. I have cleared the cache and reloaded the page, however, the above errors persist.

Please help? advice most welcome?

I highly suggest to the authors of this plugin to change the way you pull the url's in, as I have no other issues with the many other plugins I use on sites for hundreds of clients. I'm guessing that it would be a minor adjustment.

Regards
tuyre
 
Posts: 4
Joined: Sun Apr 10, 2016 1:25 pm

Re: GTranslate breaks with different wp-content URL

Postby Yana » Sun Apr 10, 2016 11:23 pm

Hi,
You can edit GTranslate plugin php files and change the URLs.
Regards,

Yana Ghahramanyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Yana
 
Posts: 4547
Joined: Thu Jan 12, 2012 6:21 pm

Re: GTranslate breaks with different wp-content URL

Postby tuyre » Mon Apr 11, 2016 10:25 am

Thanks for the response.

As I already stated, I changed the php file and the problem persists, hence I am asking for more help here.

Regards
tuyre
 
Posts: 4
Joined: Sun Apr 10, 2016 1:25 pm

Re: GTranslate breaks with different wp-content URL

Postby Yana » Mon Apr 11, 2016 7:07 pm

Can you please post your website address?
Regards,

Yana Ghahramanyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Yana
 
Posts: 4547
Joined: Thu Jan 12, 2012 6:21 pm

Re: GTranslate breaks with different wp-content URL

Postby tuyre » Wed Sep 14, 2016 12:41 am

Sorry for the delay, I was unaware you replied since I was not emailed.

Anyway, that site was offline whilst developing it. I can now be more specific as to the problem with your coding.

As mentioned, the wp-content directory name can be changed by either a plugin doing so, and also it can be specified in the wp-config.php file. Because of this, the Constant PLUGINDIR has been deprecated since Wordpress 2.1.0. I have noticed that you still use this deprecated way of referring to the wp-content directory in your code:

Code: Select all
$wp_plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );

wp_enqueue_style('gtranslate-style', $wp_plugin_url.'/gtranslate-style'.$data['flag_size'].'.css');


a better way might be this:

Code: Select all
wp_enqueue_style( 'gtranslate-style', plugins_url('gtranslate-style'.$data['flag_size'].'.css', __FILE__) );


It is recommended to use plugins_url() to refer to the wp-content directory, that way if a site has this directory name changed, it will not matter and the url to your flags and logo on the plugin settings page will still work.

In addition you still have a number of places in your coding that still refer directly to the wp-content directory that I also have to manually change. Every time there is a GTranslate plugin update, I now have to manually change this on multiple sites, just because of the deprecated constant in use on your plugin.

If you do not understand what I am telling you, please kindly ask me? This time I will definitely tick the "Notify me when a reply is posted" box.

:)
Regards
tuyre
 
Posts: 4
Joined: Sun Apr 10, 2016 1:25 pm

Re: GTranslate breaks with different wp-content URL

Postby Yana » Wed Sep 14, 2016 3:35 pm

Thank you for the information. We will consider it .
Regards,

Yana Ghahramanyan - GTranslate Team

Please leave your feedback on your CMS plugin directory. It is very important for us!
Google Translate Joomla
Google Translate WordPress
Google Translate Drupal
Yana
 
Posts: 4547
Joined: Thu Jan 12, 2012 6:21 pm

Re: GTranslate breaks with different wp-content URL

Postby tuyre » Wed Sep 14, 2016 6:37 pm

Thanks for responding. I certainly recommend making the necessary changes. There are a lot of people who would try the plugin but decide not to use it because it fails to work for them. Most people would not go to the trouble of reporting the issue and just use another plugin. I personally took the time because I believe its a useful plugin and if you get it right I'd award it 5 stars. :)
tuyre
 
Posts: 4
Joined: Sun Apr 10, 2016 1:25 pm


  • Related Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 1 guest

cron