Determine locale by domain - Wordpress - php

I am pretty new to localization. Having never had to build multilingual site, I have never built something to serve a specific language.
We currently have example.com, example.co.za and example.gr. Our Wordpress site is hosted on example.co.za in English and is served to all 3 domains in English. We want, when a user hits example.gr, to serve a Greek site. But, we only want one Wordpress site that we update and maintain. I understand that we will need to translate our content into the languages we require, but that's not an issue.
Based on the above, I have a few questions.
What would be the best solution for this?
Is it possible running 1 WP instance and achieving this, and how would I do it?
Is there a way that I can change locale by checking which domain was requested?

You can use a translation/multisite plugin like MultilingualPress Pro, they link several blogs together and help you with translating etc.
Use a multisite install, every language is an own blog (they can be duplicated with this plugin for example) and can be managed independently, but they all get connected through 1.
You could, but 1. for example automatically detects and redirects based on the browser language, which seems to me like a better solution. This works fine for me in a similar environment.
(I am in no way connected to the linked, paid plugin, but I am using it in two sites and am fine with the work it does.)

Related

Can I have a Wordpress site with a CakePHP subsite?

I'm hoping to build a website which needs to be done quickly. The website itself should be fairly basic, so I was going to just do that in Wordpress. However, it also needs functionality to allow people to register and then interact (none of this appears on the website, just a link to the user login bit). I think it's going to be easier to build that bit in CakePHP as it has some very specific functionality that I don't think I'd find a WP plugin for.
Is there a way that I can build my website.com in Wordpress and then have something like my website.com/userarea where user area is built in CakePHP?
Yes it's possible, but requires a rather esoteric configuration of your webserver, and that's assuming you are proposing to implement the cakephp part with a front controller architecture. Even if you are a nginx/apache guru I'd recommend running the two components under different vhosts.

WordPress multi site installation

i have 3 self hosted wordpress sites in same machine but each one uses different url as explained below.
publication.mysite.com (wordpress site)
info.mysite.com (wordpress site)
flipbook.mysite.com (wordpress site)
now mysite.com is our primary company's website. it is a sharepoint site. because of this i cannot create mysite.com as our primary wordpress site.
i want to keep publication.mysite.com as our primary wordpress site and under this site bring the other 2 wordpress sites (multi-installation).
below is what in am trying to accomplish.
all 3 sites should consume it's own mysql database
all should be pointing to it's directory
all 3 sites url should not changed.
all posts, and other data in all 3 sites must be retained.
how could i do this? i tried to follow wordpress multisite installation documentation but i am stuck because i do not know how to setup as per my domain requirement.
another reason why i want to do this because of search. i have a global site search plugin from wpmudev. we need the ability to search from any one of our site to other 2 sites. for example: if i am searching for a 'productA'in one site, i need to display all post related to 'productA' from other 2 sites as well.
if there is any better way to perform global search like i explained, then i would like to hear about it
Thanks for help.
Your network-wide search functionality will be difficult to achieve if you must use separate databases for each site. It will require development chops that most people don't have. I respectfully suggest you reconsider that requirement.
Multisite search, in a single database, can be done with a plugin. For example. https://wordpress.org/plugins/multisite-global-search/
A WordPress multisite installation is designed to host sites with varying URLs. The migration isn't hard to do. You set up the target multisite system with three sites (blogs, WordPress's documentation calls them) in it. Rig the URLs for each of them.
This document explains the path to follow. https://codex.wordpress.org/Create_A_Network Multisite's administrative menu offers ways to configure the individual sites.
You then export the content from the individual sites and import them, one by one, into the target sites.
WordPress is decently well documented. Read this for an outline of the process of migrating to multisite. https://codex.wordpress.org/Migrating_Multiple_Blogs_into_WordPress_3.0_Multisite

How to build a bespoke website driven by Wordpress

My questions about Wordpress
From what I can gather, Wordpress is fast becoming the norm for building content managed websites. Up until now, I have used my own CMS systems to allow my clients to manage their sites content etc. However, I was recently asked to build a Wordpress driven website, and as the client insisted on using Wordpress, I subsequently lost the contract...
Resultantly, I am very keen to learn how to build and program a Wordpress site from scratch. I am not interested in templates provided when you install Wordpress on your server, I am only interested in building a fully bespoke website, with the ability to update the content using the Wordpress management engine.
I therefore have the following questions with regards to how Wordpress works (I am completely new to this).
Can I build a completely bespoke designed website and have Wordpress manage the content?
Are there any limitations to using Wordpress to manage the content?
Can I specify which content is editable?
Are there any 'from the ground up' tutorials on starting to build bespoke Wordpress driven websites?
Where can I find the documentation for the Wordpress API (if there is one)?
Do I install Wordpress in the same way that I would if I was using the built in template engine? In other words, do I still install Wordpress as a package in Plesk for the particular domain?
Does the code have to be in a specific format, or structure?
I effectively would like to find (or be pointed to) an article that clearly explains how Wordpress works and how advanced web developers can make the most of it.
I appreciate that this question is not really related to programming, if it needs to be moved then please advise as to where I can re-post it.
My Research
I appreciate that the answers to these questions will be located somewhere on the web, but thus far, I have been unable to find any really helpful tutorials on this specific topic.
I have read through pages such as the following, and whilst they were helpful, they do not really explain 'in brief' what Wordpress is and how it can be manipulated:
Where to start
Features and Functions
I below is my answer.
Can I build a completely bespoke designed website and have Wordpress manage the content?
Yes you can. Here you can find some sites that are built on wordpress. You can get an idea of what kind of stuff can be done.
http://designwoop.com/2011/12/best-wordpress-themes-of-the-year-2011/
http://www.tripwiremagazine.com/2012/07/wordpress-websites-examples.html
Are there any limitations to using Wordpress to manage the content?
According to my experience building wordpress websites, plugins and widgets, I would say you will rarely come across where you want to do something and you can't. If you know well enough php and understand OOP you can basically build whatever you want. In fact there are so many plugins that most of the time you could even get away with not writing anything (in your case this is irrelevant as you want to learn).
Can I specify which content is editable?
Yes. Other wise there is no point of using any CMS. I am sure this would be the most basic feature of any CMS out there.
Are there any 'from the ground up' tutorials on starting to build bespoke Wordpress driven websites?
Here are few tutorials you can start with.
nettuts
css-tricks
wptuts
And of course the best way to learn is the starter theme that comes as default with wordpress installation. You can find more themes here.
Where can I find the documentation for the Wordpress API (if there
is one)?
The wordpress documentation is quite detailed covers most of the things. While learning or even further this will be your best resource. I usually tend to read the code itself if I want to know how the function works and other details which of course documentation won't cover.
Do I install Wordpress in the same way that I would if I was using
the built in template engine? In other words, do I still install
Wordpress as a package in Plesk for the particular domain?
Installing wordpress is as simple as copying it to your server and accessing it via the browser. You will get on screen step by step instruction. It could not be easier than that. And if somehow you got stuck, there are hundreds of tutorial online or you can visit the wordpress codex site.
Does the code have to be in a specific format, or structure?
Of course you would be following the wordpress coding style (not necessary for but recommended for sake of being consistent). Depending on your skill level you will fairly pick up the standards.
If you are building plugins or widgets, which I assume if you want to build sophisticated websites, you must follow the coding standards.
By the sounds of it, you need to learn about writing a theme from scratch. A Wordpress theme gives you absolute control over the HTML that's outputted by the engine. You can therefore customise your site to look however you want it to look. My company website, tec20, was designed this way without any themes used from wordpress.com. Obviously the themes are aimed at writing blog sites, but you don't have to include any of the commenting hooks, for example.
These tutorials may help:
http://rockablethemes.com/wordpress-themes-tutorials/

Using Wordpress as a CMS - advice on doing it for localhost?

I have a plain-vanilla install of Wordpress on localhost, virtual host in Apache set to:
127.0.0.1 myradiostationhere.com
127.0.0.1 www.myradioanytown.co.uk
and the virtual host works.
However, I don't want to use it as a blog, but as a CMS like here:
http://www.brmb.co.uk/
and
http://www.brmb.co.uk/schedule/
(basically, any pages on that site are database-driven Wordpress pages, not blogs).
I'm not asking how to create pages etc. - I understand that - but rather if anyone knows of the best way to do this.
I'm trying to emulate their look, but with similar CSS stylesheets, as per:
Fair dealing in a work for the purposes of private study or research (s. 29)
under Copyright, Design and Patents Act 1988 (that's the legal bit out the way).
Would I need to edit the PHP files in order to get this to work in the way I intend to?
Anyone here had experience of custom Wordpress CMS design/installs, and how would you recommend I go about this?
(note: This isn't for a live radio station site, it's a development/testing site on localhost!)
You basically want to create WordPress theme.
You will need a bit of PHP editing, but mostly of the copy-and-paste variety (to get you started).
Another option is to download a similar free theme or even buy one.

Joomla to Static HTML website

I have a Hindi magazine website hosted on Joomla. Though helpful from publishing point of view the site was a maintenance nightmare. Joomla is so much susceptible to hacker attacks. My host will often shut down my site due to bots attacking my website. Recently I relaunched the site as a new Wordpress based site on a different name. The Joomla based website would therefore never be updated anymore. However, I do want to maintain the old content. I have used PHP but hardly am a power user.
I want to convert the files as plain HTML. I created a mirror of the website using HTTrack. But thanks to the fact that Joomla had variety of URLs for the same page (if you used a SEF URL plugin you would understand) the mirror is full of redundant content. Moreover I have repetitive HTML content (for header,footer,menu etc) in each page.
My questions are:
Which is a better option, create a static HTML site or PHP4.x pages (with Unicode content and having include PHP fragments for repetitive content)?
If latter is better should I use template system like Smarty? I am worried about caching since the content will hardly be updated I want caches to last forever.
Thanks for the help.
If the content is not going to change frequently I recommend using HTML files. They are static and hence faster.
However, if you are going to be updating content frequently, then you can either upgrade to the latest version of any popular CMS preferably joomla or drupal. I cite these two because they are actively developed and you can get a lot of support for them on the internet. Be sure to follow their security guide for hardening your installation.
If I were you I'd move everything over to WordPress since you have started using this. This way you will be maintaining a single website application keeping things better manageable in the long run.
You can copy the data out of Joomla using the Joomla administration interface. Or maybe even quicker using a database tool like MySQL Tools or Navicat which has a lot of export options.
Copying the HTML from Joomla using tools like HTTrack or TelePort Pro will result in lots of duplicate code and pages like you state.
Maintaining an extra PHP site just for the old content will be as much effort as getting everything into WordPress.
The "Static Content" project at: https://github.com/juliopontes/staticcontent does exactly what you are after although it looks like it may need to be updated for Joomla 3.5.

Categories