Thivinfo presents a new service: paroisse-catholique.fr

Today I’d like to share a new project that I hope will be of great use to some of you.

Once upon a time 5p2p

I worked for just over 2 years for the charity 5 Pains et 2 Poissons, whose aim was to facilitate digital access for church associations.

As a WordPress developer, I produced websites for religious institutions and congregations. This experience enabled me to discover a world that needs to communicate effectively… but doesn’t have the means to do so.

WordPress at the service of the Catholic Church!

At the end of this experience, the idea came to me to create a service that would enable parishes with low incomes to access a quality web service that met today’s web standards.

What does Paroisse-catholique.fr offer?

Paroisse-catholique.fr offers a turnkey solution that allows you to create your own parish website without any technical knowledge.

  • Easily publish news for your parishioners
  • Plan your parish and local events
  • free yourself from constraints, manage only the communication of your parish easily.
  • Make it easy for your parishioners to contact you
  • Easily set up donation campaigns (denier du culte, donations, etc.)

What areas are available?

For the time being, you can obtain a sub-domain of one of the following domains as part of your subscription:

  • parish-catholic.fr
  • parish-catholic.org
  • parish-catholic.net
  • parish-catholic.info
  • paroissial.fr
  • my-parish.org
  • ma-paroisse.fr
  • your personalized domain…

Multisite in WordPress: Why? How do I do it?

In this tutorial, I’ll explain what a WordPress multi-site is, why set it up and most importantly how!

What is a multi-site?

Most of you might be familiar with “classic” WordPress, or “single” WordPress as it is also called. It is an installation of our CMS that will be used to proudly power a website.

By enabling the “Multi-site” feature, your “classic” WordPress with a single installation will be able to power as many websites as your server can handle!

The best example in this area is wordpress. com, the website platform created and managed by Automaticc. This commercial service that powers several million websites is in fact a single installation of WordPress!

Since WordPress 3.0, multi-site functionality is fully integrated into WordPress.

When to use a site network?

It can be interesting to create a site network when you are going to have several sites to host… you will then manage only one installation sharing themes and extensions. You will save time in maintenance since you will update for example only one WordPress core, one extension or theme version.

Different uses

Multi-site is also sometimes used to create a multilingual site. You can assign a language to each site and write different content for each site.

The networked sites can also be used to create a site by site company, a holding and its subsidiaries for example.

How do I set up a multi-site with WordPress?

There are 2 ways to create a site network:

  • In sub-domain: your url will be in the form site1.example.com, site2.example.com
  • In sub-folder: your url will be like exmple.com/site1, example.com/site2

If you install your network on a new installation, you will have the choice between these 2 structures. If you are converting an existing WordPress installation, you will have no choice but to choose the sub-folder installation.

Note that there is nothing you can’t do with one installation that you can do with the other!

Creating the network

First of all, for this example, I’m going to start with a local installation of WordPress.

Of course, it is highly recommended to make a full backup (files + database) at this level.

If you follow the WordPress developer’s bible, I named the Codex, you will understand that you have to create a PHP constant in the WordPress configuration file located at the root of your installation.

/* Multisite */
define('WP_ALLOW_MULTISITE', true);
/* That's all, don't touch the following! */

The purpose of this constant is to tell WordPress that we allow it to create a Multisite:

WordPress

Let’s click on the new entry in the “Tools” menu named “Network Creation”. You will get this page:

Capture d'écran

It is at this step that you can choose the structure of your URLs. Either in subdomain or in subfolder. If you want to choose the URL in sub-domain, you will have to create a wildcard entry in your DNS records.
In my example above, to get site1.tuto-multisite.local you will have to create a wildcard in DNS with the asterisk character (*) : *.tuto-multisite.local and point it to the folder containing your WordPress installation.

Click on “Install”

Capture d'écran

Ok so there I have an error message because I requested a subdomain installation of my WordPress network and I didn’t create a wildcard domain as requested. This is because on my local installation… it’s not easy!
WordPress tried to create the random sub-domain 14b292.tuto-multisite.local on the fly and failed. If you are installing locally, you can create the domain by editing your “Hosts” file.

The installation is almost finished, you just have to copy the 2 blocks of code in the .htaccess and the wp-config.php of your installation. Replace the content of your .htaccess with the block above.

It’s done? Click on the “Connect” link

Congratulations! Your WordPress site network is installed!

Let’s discover the new Back-Office of our newly installed multi-site WordPress.

Logo

The main change, as you may have noticed, is the appearance of a new menu, the network administration menu:

Here will be listed all the sites you can create on your site network as a Super-admin. Indeed, by activating the multi-site mode, a new role has been created, that of “Super-Admin”.

What is the “Super Admin”?

On a typical WordPress installation, we have the roles of “Subscriber”, “Contributor”, “Author”, “Editor” and “Admin”. The Administrator is the highest role, the one with the most rights on your installation. It is the user with this role who will be able to add, activate, delete an extension or a theme. He will also be able to completely configure your installation.

On a multisite installation, the installation of extensions and themes is done at the network administration level and not at the level of each site. So a new role was needed to manage this new level of administration.

If we summarize, an administrator will be able to manage his site while the super-administrator will be able to manage all the sites of the network as well as to install themes and extensions which will be available on all the network.

General principles of operation

Now your Multisite is installed but I won’t leave you like that!

Know that an extension like a theme is installed as a Super-admin on the network admin dashboard.

Know that an extension activated at the network level will be available on all the sites of your Multi-site BUT you can activate an extension site by site, or each site administrator can activate an extension on his site.

For themes, it works a little bit different, it must be active on the network to be activated on each site. So, if you have a theme and its child, you can activate only the child theme so that no changes are made to the “parent” theme.

One WordPress for several sites? Why not switch to domain mapping?

Setting up a multi-site – multi-domain WordPress at O2Switch

Migrate a site from a multisite to a classic installation

Introducing the WordPress multisite.

The Multisite technique allows you to run several WordPress sites together within a single installation.

This technique allows you to share the WordPress core, themes and extensions.

This results in significant time savings when maintaining your sites since you only update once.

Read more about this:

Extracting a site from a multisite step by step.

First of all, this tutorial is not meant to be THE method but a method that works and that I put into action today as part of my job as a WordPress developer.

Step -1 – Backup

Saaaaauuuuuvvvvvveeeeegggggaaaaaarrrrrrdddddeeeeee

Backup your files (WP, extensions, themes, mu-plugins and Mysql database)

Step 0 – Local installation

Having the multisite locally, it will be much easier to manage and in case of accident, it will generate only you!

Step 1 – Updates

The first step will be to update your multisite:

  • WordPress
  • Themes
  • Extensions
  • Languages

If this step is not fundamental, I think that:

  1. it can’t hurt
  2. it can avoid conflicts and worries later on when you import themes and extensions into your “Classic” WordPress site.

Step 2 – Installing WordPress

Install a brand new WordPress… For this I suggest you do it in 3 minutes thanks to the wp-cli script I created for you…

OK I admit, I created it for myself… and I thought you might be interested!

Step 3 – Transferring the files

So now, let’s start a file transfer. That’s why I asked you in step 0 to work locally. It will be much easier to move files in the explorer of your machine than remotely via sFTP or whatever.

Remember to transfer:

  • Themes (parent and children)
  • Extensions
  • Mu-plugins
  • the “uploads” folder… but I reserve him the step 4!

Of course, on the multisite maybe not all the extensions or all the themes were useful for the site you are extracting.

Upload only what you need and do not activate anything

Step 4 – the “Uploads” folder

The Uploads folder located in `wp-content` contains all the media uploaded to your site and available in the media library.

Admit that it would be a shame not to find them in your new installation.

The Upload folder is a little different to transfer since its folder and subfolder architecture is different from a classic installation.

Logiciel
Architecture of the Uploads folder in Multi-site

Notice the difference with a classical architecture. In “uploads”, we have a “sites” folder that does not exist in a regular WordPress installation.

Inside this “sites” folder we have a folder named by the id of the site in the multisite infrastructure.

Then we find the classic WordPress media classification with a year folder and a month folder.

Find the site ID to extract from the multisite

I believe that if you do this manipulation then you have the privileges of super-administrator.

This step is quite simple, you have to go to the network administration of your multisite then in the submenu “Sites” at the end of the line concerning the site to migrate you will find the ID of this one.

Microsoft Azure
Find the ID of the site to migrate

The ID recovered you can move all the contents of the folder with the id as name in wp-content/uploads to find the classic tree structure of a WP.

Step 5 – export then import the database

It’s all very well but for the moment, you have everything except your content…. and in a site, it’s the most important thing, the database.

For this tutorial, I will assume that you have the default prefix “wp_”.

Just like media, WordPress multisite adds the id of the site on some tables.

You will have to export all the tables with the ID as well as the wp_user and wp_usermeta tables which do not have an id because in a multisite, the users are common to all the sites.

Personally I do it with PHPmyAdmin if the tables are not too big… we select the desired tables (example: the one of the site “4” wp_4_ as well as the 2 users tables).

Before importing, delete the tables wp_user and `wp_usermeta` from the classic installation to avoid conflicts with the tables you are going to import.

For the import in the classic WP, also use the tool you are used to.

You will end up with duplicate tables: those of your classic installation and the one you just imported that have the prefix `wp_4_`. Delete the duplicate tables from the classic installation.

Import your “multi-site” tables

At this stage, if you look at your database in PHPmyadmin or other, you should notice some tables in wp_ and others in wp_4_

In PhpMyadmin, check all the tables in `wp_4_` then at the bottom of the page in the dropdown menu select “Replace table prefix”

If you decide to change the table prefix, don’t forget to correct the `wp-config.php` accordingly.

Document

We’re almost there!

Step 6 – Replace the media URLs in the Database.

For this I use the SRDB script from Interconnectit. You can find a guide to this script from my friend Grégoire Noyelle.

Here we are going to modify the urls to the medias and thus make a search and replace which would look like this:

Search: https://example.com/wp-content/uploads/site/4/2019/02/mon-image.jpg

Replace: https://example.com/wp-content/uploads/2019/02/mon-image.jpg

Step 7 – the user base

When importing the database, we imported all the users of the multisite… but some of them have no relation with the site you just extracted.

Unfortunately, I haven’t yet found an sql query that fits … if you have an idea, submit it to me in comments, I’ll be happy to improve this tutorial.

Step 8 – Checks

Normally, your classic site is an exact copy of your site when it was in the multisite.

Depending on your setup, there may be 2/3 things to adjust. For example, replace urls to images written in hardcopy in css files created by Elementor page builder…

You may have transferred extensions that are only useful for a multisite…

Step 10 – Rest!

Yeah, there’s no step 9 because it’s good to stop on a round number! a dozen or so!

Normally you have just extracted a site from a multisite to a classic WordPress site… you have earned a little foam, a coffee or anything else that will make you happy!

And if not, there’s the easy way! (added on April 20, 2019)

If like me you are adept of WP-CLI then this script will allow you to extract a site from the multisite in a few seconds…

trepmal/blog-extractor

WP-CLI command. Extract single blog from multisite – trepmal/blog-extractor

https://github.com/trepmal/blog-extractor

Domain Mapping with WordPress multisite

In the previous episode, I simply presented (at least I hope so) how to set up a multisite with WordPress. We saw that we could create as many sites as we wanted on the basis of a single WordPress installation.

The created sites had then 2 possible syntaxes :

  1. in subdomain ex : site1.example.com
  2. in sub-folder ex : example.com/site1

Admit that it’s a good start but if we could also have a personalized URL… then it would be perfect !

When I say personalized URL, I mean a site address like thivinfo.com for the first site and tartempion.com for the second.

This is precisely where domain mapping comes in.

Setting up the registrar side

Yes, you will have to set up the domain names you want to map at your registrar. I can’t detail the way to do it because it is specific to each host depending on the administration panel used.

Please note that if your domain name is managed by your host, you must point this domain to the root of the folder containing your WordPress installation.

Setting up the WordPress side

Once your domains are pointing to the right folder, you have to tell WordPress that it will have to manage one or more other domains.

Concretely, let’s imagine that I have a network of WordPress sites on the tuto-multisite.local domain and that on this network of sites I have a site https ://tartempion.tuto-multisite.local. https ://tartempion.tuto-multisite.local is a fully accessible URL (locally but the principle is the same on a public URL) and I could stay like that. Except that to communicate it would be easier to give as URL tartempion.com.

The goal is to make all the requests point to tartempion.tuto-multisite.local and send them to tartempion.com.

Installation of the extension

For this, we will use an extension available for free on the WordPress repository : https ://wordpress.org/plugins/wordpress-mu-domain-mapping/

We are in Multisite WordPress, so the installation of the extensions is done at the network administration level.

Programme d'ordinateur

Then, as on a classic WordPress site, you look for the WordPress MU Domain Mapping extension, install it and activate it on the network.

Go to the network admin level in the “Domain Mapping” menu. And there : It does not work and you have a line saying :

“Please copy sunrise.php to /path/to/wp-content/sunrise.php and ensure the SUNRISE definition is in/path/to/wp-config.php”

Which can be translated as :

“Please copy sunrise.php into path/to/wp-content/sunrise.php and ensure you have defined SUNRISE in your wp-config.php file”.

Brancher

Attention, here is THE complicated part of this tutorial dedicated to domain mapping !

In the extension directory under wp-content/plugins/wordpress-mu-domain-mapping you will find the file sunrise.php

Conception

Take this file and drag it under wp-content/

Les données

We just have to define a PHP constant to allow domain mapping in the wp-config.php

to the part where you have declared the multisite, add

define('SUNRISE', true);

to get something like :

define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'tuto-multisite.local');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

define('SUNRISE', true);

If you go back to the domain mapping settings you will see this new settings menu :

Capture d'écran

Save your settings and… your WordPress multi-site multi-domain is ready ! o/

Map your 1st WordPress domain

So we’ll map tartempion.com to tartempion.tuto-multisite.local.

Being local and not really owning the tartempion.com domain, I will modify the hosts file of my machine to simulate this domain.

I go to the administration of my site to be mapped https ://tartempion.tuto-multisite.local/wp-admin/ then in the menu “Tools/Domain Mapping”.

You will find this page :

Document

Fill in your domain to map (donations my case tartempion.com without http or https). If the domain will be the main domain then check “Primary domain for this blog”. This way you will be able to have as many domains mapped for a site (the www.tartempion.com for example) but only one will be served.

Congratulations ! You have mapped your first domain !

Thanks to Bruno Tritsch for making the following video tutorial illustrating perfectly my tutorial.

3 minutes to install WordPress!

We read everywhere that it takes 5 minutes to install WordPress… and it’s FALSE! We’ve been lied to! We can install it much faster than that…

The proof in video!

Those of you who have already installed a multisite know that after installing WordPress, you have to enter constants in the wp-config.php to activate this mode, go to the Back-Office, configure the network and return to the wp-config.php to paste a pad of constants as well as in the .htaccess … in short much more than with the script I have concocted!

How does it work ?

I’ve created a bash script that, when you run it, asks you a few questions.

Nothing nasty, it’s the information you would enter during the routine of installing a WordPress via your favorite browser.

Once the answers are recorded, the script launches the installation and the multisite is ready … in 3 minutes!

Of course this script will need wp-cli to work.

Command line interface for WordPress | WP-CLI

Command line interface for WordPress | WP-CLI

WP-CLI is the command-line interface for WordPress. You can update plugins, configure multisite installs and much more, without using a web browser.

https://wp-cli.org

I’d like to have the Seb Scripts!

Yeat get it on Github 😉