Wordpress: Pre-path mode for a multilanguage solution ("/en/", "/de/") - wordpress

I need to have a pattern in the url on the whole website to control which language is shown. The pattern www.website.com/en/permalink should generate a variable like $lang="en".
I have tried different approaches like add_rewrite_rule, add_rewrite_endpointor adding rewrite rules via add_filter('rewrite_rules_array') and using preg_matchto generate the actual pattern from the $_SERVER['REQUEST_URI'].
I also had a look on plugins like qtranslate that does very well what i need but the sourcecode is too complex for me to understand.
After all, I dont understand how to do this in a good way, what is the best approach to achieve this?
The language pattern has to stay in the URL on the whole page, like in qtranslate, f.e. after clicking a menu-link the pattern has to be shown in the url again.
The solution has to be SEO-friendly.

If you aren't confident doing this, the quickest way is to get the WPML (wordpress multi-language) plug-in.

Related

Grabbing the HTML within a div / class / id from another website

I'm currently creating a website using Wordpress. On one of the pages I want to extract news articles from another website, but I don't want to use iframe (I want to style it with css), nor do I want the entire page, just what's within the text of the article.
I'm pretty new to coding (which is one of the reason why I'm using wordpress), so I'm not sure how to go about it. I've looked around online, but the answers are either different from what I need, or they're far beyond my understanding. If there's some sort of wordpress plugin that does the job for me, that'd be great, but otherwise I'd be grateful to be pointed in the right direction.
Thanks.
Look for RSS feed, it might contain the content you need and its easier to grab things from RSS than from HTML. Or simply download the page via any programming language into object and find the element with either REGEX or Xpath.
Or use WordPress WebScraper plugin: Here

Qtranslate-xp (qtranslate-plus) url work with qtranslate-slug plugins

I am using one plugins https://wordpress.org/plugins/qtranslate-xp/ for my WordPress site. Now I want about us page URL in three language. Means I want unique slug for about us in each language like english, deutche, etc.
Does any one know how to do that? Also, I have come to know about qtranslate-slug plugins but that is not working with qtranslate-xp. so can you please let me know how to do this?
if I understand your problem, you can replace Qtranslate-XP with mqTranslate (upgrade on 2015-2-27) and you can use Qtraslate-slug.
Qtranslate-XP and mqTranslate use same tags.

Wordpress-blog with two languages - which plugin?

I spent a couple of hours in the search of a solution to a two-languages-blog (site?). It seems that there are two general approaches: a single site which holds both languages; or two sites (thus WP installations) where each one holds a single language.
The solution for the latter one would be the Multisite Language Switcher.
But in principal, I'd prefer to work with a single site. Less hassle.
And I would like to use the same "New Post" page to enter the title and text for the languages - thus two title boxes, two text boxes. If I upload an image, I can insert it directly into each of the text boxes.
There, it seems the WPML is the way to go. Not sure about qTranslate. Tried it but only the title box was added.
Can you recommend anything else? Or am I thinking to narrowly? Thanks a lot for any hints or tips!
http://wordpress.org/extend/plugins/polylang/ - easy to use and manage languages.
For each post you choose the language you'll need. You won't get to add both languages in the same post since it would result in the same url.
For images, you don't need to upload it twice, just choose it again from the media library.
Not free, but WPML is probably the most advanced language plugin (hence the not free part). It will allow you to use a single install and choose the language based on directory or query string parameter. Overall fairly affordable.
http://wpml.org/
Tried out a couple of plugins. Finally spent many hour with multisite and domain mapping. When I got it working, I used the Multiple Language Switcher.... and like it a lot! Thanks for the hints!

How do I create an html link that has a link name, the same as the URL address?

Is this the easiest way in an html doc to create a link to a page that has the same name as the url?
So basically it will say:
Please click the following link:
http://test.com.
That is all I want it to say.
The code I wrote for this is as follows:
http://test.com.
Or is there a more all inclusive way where you don't have to write the name of the url twice?
Obviously my code doesnt include the initial text, this is just for example purposes.
Unless you want to copy the URL from one place to another using JavaScript, you will have to write the URL twice.
I advise agains the JavaScript copying, because its performance and SEO costs are much worse than the cost of typing everything twice.
What you have got now is the easiest way.
If it's not an option for some reason you can use server side scripting to search the page content for URLs and wrap an <a> tag around them.
This will require some very complicated regex. Daring Fireball has a very good blog post instructing you how to do this, and explaining exactly why it's actually impossible for this to be perfectly reliable (which is probably why HTML doesn't allow it):
http://daringfireball.net/2010/07/improved_regex_for_matching_urls
I've done this sort of thing before (with emails actually) and it's very difficult and took years to get right. If at all possible, you should just do what you're already doing - manually type in the <a> tag yourself.
Alternatively, you could use something like smarty (for PHP. I don't know what the ASP equivalent would be) to write something along the lines of the following, to programatically generate the full <a> tag:
{link url='http://example.com'}
Why don't we just sidestep the issue by making our links more semantically-rich?
Instead of:
For more information on our delicious pizza, visit www.pizzasrawesome.com.
Use this:
Read more about our delicious pizza.

Zen cart using html links, but no html files

I am working with a pre-existing zen-cart site has been worked on over the years by multiple teams. Backtracking through all of the teams is not a viable option. Some of the development teams implemented some hacks, one of them being replacing how zen-cart normally creates links, and I am stuck as to how they did it. For example, zen-cart normally links to a product through a link such as the one below:
http://yoursite.com/index.php?main_page=product_info&cPath=67&products_id=823
Instead, this zen-cart installation is doing the following:
http://yoursite.com/item-name-here-p-45-.html?cPath=1_26
I have figured out that the number after p-, in this case 45, is the product ID. However, I am stuck as to what that .html file is actually referencing. I am guessing that it is somehow feeding that data back into the index.php file, and it was done for search engine optimization purposes. The server is using nginx if that makes a difference. I would rather use apache for this site, but I am fine with nginx.
Additionally, there are also links such as:
http://yoursite.com/sitemap.html
but there is no file called sitemap.html on the entire system. However, there is a file called sitemap.xml
For a myriad of reasons, I can't link to the actual site and I hope you fellow developers can understand that. However, if anyone has any idea as to whats going on here, I would be very interested to know. I will provide what other details I can.
I just figured this out, and I want to share my answer for anyone that stumbles upon this. This was caused by something called Ultimate SEO which masks urls with html links to make them more search engine friendly. The reason there are no actual html files involved is because Ultimate SEO creates a .htaccess file that reads the filename from the URL, and converts it to parameters to be passed to a php file. I just simply disabled Ultimate SEO from the zen-cart admin page. Furthermore, Ultimate SEO is something that is used outside of Zen-Cart, so if you are having the same issue I did, this might be it, or something similar.

Resources