Forum Archive - GTranslate breaks with different wp-content URL

GTranslate breaks with different wp-content URL
Apr 10, 2016 9:38 am by tuyre
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: 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
Re: GTranslate breaks with different wp-content URL
Apr 10, 2016 7:23 pm by Yana
Hi, You can edit GTranslate plugin php files and change the URLs.
Re: GTranslate breaks with different wp-content URL
Apr 11, 2016 6:25 am by tuyre
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
Re: GTranslate breaks with different wp-content URL
Apr 11, 2016 3:07 pm by Yana
Can you please post your website address?
Re: GTranslate breaks with different wp-content URL
Sep 13, 2016 8:41 pm by tuyre
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: $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: 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
Re: GTranslate breaks with different wp-content URL
Sep 14, 2016 11:35 am by Yana
Thank you for the information. We will consider it .
Re: GTranslate breaks with different wp-content URL
Sep 14, 2016 2:37 pm by tuyre
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. :)

SIMILAR TOPICS

Gtranslate MultisiteFeb 12, 2019 7:27 amReplies: 1Post by: infact_dat
Gtranslate: Error with numberFeb 20, 2019 1:20 amReplies: 1Post by: infact_dat
GTranslate 3.7.4, Joomla 3.9.3 - doGTranslate is not definedFeb 22, 2019 12:34 pmReplies: 1Post by: oase
Add-on gtranslate no longer worksFeb 2, 2019 6:01 amReplies: 1Post by: DarylDixon
Instragram and Gtranslate...!!!!Dec 19, 2018 11:18 amReplies: 1Post by: zackfernandes

Try GTranslate with a free 15 day trial