Set up a WordPress Multisite Network on subdomains using MAMP PRO 5 on a Mac

Adding a multisite network to your local development environment can be a real pain. I wrote a script describing the major steps and configurations I use to get up and running. The goal here is to have the following sites set up in a local network for testing:

  • http://ms1.test (The main network site)
  • http://sub1.ms1.test (Subdomain site)
  • http://sub2.ms1.test(Another subdomain site)
  1. Start MAMP PRO and go to the Ports tab. Choose the option Set server ports to 80, 81, 443, 7443, 3306 and 11211
  2. Go to the Hosts tab and create a new host. Select the site root directory – any empty writable directory is fine. Check “Install WordPress” when creating the host.
  3. Add your desired WP admin user info and your local database credentials in the following dialog screen, then click “Create Host”.
  4. Stop and restart your webservers in MAMP if they are not automatically restarted for you.
  5. Check your local database to confirm the database was created successfully, and confirm in the wp_options table that the site URL is correct.
  6. Go to http://ms1.test/wp-admin in a browser and log in using the admin credentials you already provided.
  7. Edit your site’s wp-config.php file. Add the following line:
    define('WP_ALLOW_MULTISITE', TRUE);
  8. Reload the dashboard in wp-admin and go to Toolset > Network Setup. Select “subdomains” instead of subdirectories, and add your network title and admin email information.
  9. Copy the .htaccess code shown on the next page and save it into your site’s .htaccess file, overwriting any existing information. Disregard the other code and warnings shown on this page.
  10. Edit wp-config.php again. Remove or comment out the WP_ALLOW_MULTISITE line and paste the following lines just after it:
    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', true);
    define('DOMAIN_CURRENT_SITE', 'ms1.test');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('ADMIN_COOKIE_PATH', '/');
    define('COOKIEPATH', '');
    define('SITECOOKIEPATH', '');
    define('NOBLOGREDIRECT', 'http://ms1.test' );
  11. Save wp-config.php and return to MAMP PRO. Select the ms1.test host entry and find the Aliases panel. Add an alias for each subdomain:
    sub1.ms1.test
    sub2.ms1.test
  12. Save and restart the webservers.
  13. Go to ms1.test/wp-admin, where you will have to log in again. Use the network admin credentials.
  14. Go to My Sites > Network Admin > Sites, and add subdomains here as separate network sites.
  15. Log in to each site’s dashboard from Sites > All Sites.

Bring back old Toolset Menu, and have Layouts Edit Button as well if layouts is assigned to content

The Toolset Menu in the Front End WP Admin Bar, if Layouts is assigend to the content, becomes leads to the Front End Editor of layouts.
You cannot access other Toolset items with it anymore.

Often Clients have nested Views and to quickly access them, the old menu was perfect.
The new way will introduce a lot of time wasted clicking around in the admin.

To those clients we can provide a filter that brings back the old Toolset Menu.

It is also very useful for debugging.

add_filter('toolset_filter_toolset_admin_bar_menu_disable', 'my_layout_menu');
function my_layout_menu(){
	return false;
}

Quickly expose a local server online with ngrok

  • Download ngrok
  • Create an account and enter your authtoken
     ./ngrok authtoken
  • Then execute:
    ./ngrok http -host-header=your-local-site.dev 80
  • In the screen that follows, ngrok will show the new publicly accessible address of your site
  • Finally, you’ll probably need to run the following command with wp-cli in order to replace your local links with the new ones:
    wp search replace old-url new-url

OTGS Projects Statuses

This tool can be used by developers and supporter.

Developers can use this tool to monitor the status of one or more projects.

Supported can use this tool to easily retrieve a development version which can be installed in test sites and, in some rare cases, to send it to clients when the project leader agreed to do so.

All the information on how to configure and use this tool can be found here.

If you find any issue, please report them here.

f.lux

Ever notice how people texting at night have that eerie blue glow? Or wake up ready to write down the Next Great Idea, and get blinded by your computer screen? During the day, computer screens look good—they’re designed to look like the sun. But, at 9PM, 10PM, or 3AM, you probably shouldn’t be looking at the sun.

f.lux fixes this: it makes the color of your computer’s display adapt to the time of day, warm at night and like sunlight during the day.

It’s even possible that you’re staying up too late because of your computer. You could use f.lux because it makes you sleep better, or you could just use it just because it makes your computer look better.

f.lux claims to work on Windows, Linux and Mac. For Linux, there is a simpler alternative called redshift (with an optional redshift-gtk package).