Coder Social home page Coder Social logo

planet4-base's Introduction

Greenpeace Planet 4

This project provides the base for all Planet 4 sites.

To create a new project, that is powered by Planet 4, fork this repository.

Prerequisite

  • You will need to have PHP and composer available on your system.
  • You will also need both git and subversion (since some core wordpress components are using svn).
  • You will also need mysql or mariadb installed as well.

Installation

All dependencies should be managed by Composer. They are listed inside the composer.json file in the root of this repository. Install all required dependencies with one simple command:

composer install

If you want to add more dependencies to this project, you should also always add them to the composer file. No manual copying of plugins or themes should be necessary and any time.

Configuration

You need to create a Wordpress command line configuration file. You can do that by copying the default one:

cp wp-cli.yml.default wp-cli.yml

This file is not tracked by default since it contains the complete configuration of your Wordpress instance such as your database user passwod. When you need to change the database configuration, the title or the URL of this installation, please edit wp-cli.yml.

path: public

core config:
  dbuser: root
  dbpass: root
  dbname: wordpress

core install:
  title: Sample Planet 4 website
  url: http://test.planet4.dev
  admin_user: admin
  admin_email: [email protected]

theme activate:
  - planet4-master-theme

NOTE: your website will be installed on the subdirectory "public" of the current directory. Make sure that the "url" in the above configuration points to the directory "public" so that wordpress sets up its live_site configurations correctly.

Database setup

Before we can initialize the installation, make sure you did create the database that is configured inside the configuration file. This can be easily done with this command:

echo "CREATE DATABASE wordpress;" | mysql

It might be necessary to pass a username (-u) and a password (-p) to the mysql command. More information about this is available in the man page of mysql or online.

Install and active plugins and themes

After the database is created, the new Wordpress installation is installed with one simple composer command:

composer run-script site-install

This will perform multiple steps:

  • Create a public directy and copy the Wordpress core in it
  • Create a wp-config.php file with default values from the wp-cli.yml.
  • Create the initial database structure and insert the default data
  • Copy themes and plugins listed as dependencies in composer.json.
  • Activate all the plugins listed as dependencies.
  • Activate the theme that is configured inside the wp-cli.yml

Updating

In case a new version of the Wordpress core (a theme or plugin) is published and you can update your base site by changing the version in composer.json and/or running the update:

composer update
composer run-script site-update

This will perform multiple steps:

  • Fetch the new versions and dependencies
  • Merge the new wordpress core in the public directory without deleting your added files
  • Copy all the themes and plugins
  • Run Wordpress core database udpates if any
  • Deactivate and reactivate all the plugins

Installing an alternate theme

Themes should never be changed inside the web front-end.

Please note that only the themes that in greenpeace composer repository will be available by default. You will need to add another repository if it is not a supported theme

This would make it impossible to have an automated installation that can be re-applied whenever needed. To change the theme add the dependency to the composer.json file.

"require": {
    ...
    "greenpeace/planet4-another-theme": "4.7.2",
    ...
}

Then you need to change the related line inside the wp-cli.yml.

theme activate:
  - planet4-another-theme

After that you can run this composer command to fetch and activate the theme:

composer update
composer run-script theme:install

The theme will be copied to the public folder and activated to use by the current Wordpress installation.

planet4-base's People

Contributors

koyan avatar stripthis avatar tobiastom avatar angtheod avatar sagarsdeshmukh avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.