sh 安装并激活WooCommerce和Storefront的新WordPress站点。您必须安装Laravel Valet或Valet +

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 安装并激活WooCommerce和Storefront的新WordPress站点。您必须安装Laravel Valet或Valet +相关的知识,希望对你有一定的参考价值。

#!/bin/bash

# Function to display usage instructions when the command is used incorrectly
function usage {
	echo "usage: wc-site <name> [--master]"
	echo "e.g. wc-site gradient will create a site at https://gradient.test"
	echo "The \"--master\" switch will install the current WooCommerce master from Github"
	exit 1
}

# If the wc-site command is run without the site name, display usage instructions
if [[ -z "$1" ]]; then
    usage
else
	# If only the site name is supplied, assume WordPress.org version of WooCommerce is wanted
	if [[ -z "$2" ]]; then
		woo="woocommerce"
	# If master switch is used then current WooCommerce master from Github is wanted
	elif [[ $2 = "--master" ]]; then
		woo="https://github.com/woocommerce/woocommerce/archive/master.zip"
	# If a second argument other than "--master" is supplied, teach the user how to do it
	else
		usage
	fi
fi

# Change current directory to Sites
cd ~/www/sites/

# Create WordPress site. Set the database name to be the same as the site name.
# wp valet uses `wp_<name>` which I'm not keen on
wp valet new $1 --dbname=$1

# Make the site https if you're using Valet. Not necessary with Valet+
# valet secure $1

# Change current directory to the new site so you can work your WP-CLI magic
cd ~/www/sites/$1

# Install & Activate WooCommerce based on whether the master switch is used or not.
wp plugin install $woo --activate

# Install & Activate Storefront
wp theme install storefront --activate

# Install & Activate the WP-CLI Login Companion Plugin
wp login install --activate

# Update permalink structure
wp rewrite structure '/%year%/%monthnum%/%day%/%postname%/'

# Launch the site in your default browser
# valet open $1

# Launch the site's /wp-admin/ in your default browser
# wp admin

# Generate a Magic Link and Log in to the site in your default browser
# Luminus is the default admin username for my local sites
wp login as luminus --launch 

以上是关于sh 安装并激活WooCommerce和Storefront的新WordPress站点。您必须安装Laravel Valet或Valet +的主要内容,如果未能解决你的问题,请参考以下文章

作为单选按钮的WooCommerce变奏曲

php [WooCommerce Store Credit]修改已发送的电子邮件

php [WooCommerce Core]查询WooCommerce是否被激活

php [WooCommerce Core]查询WooCommerce是否被激活

php [WooCommerce Core]查询WooCommerce是否被激活

php [WooCommerce Core]在主题激活时设置WooCommerce图像尺寸