Skip to content

Instantly share code, notes, and snippets.

@thedigitaloctopus
thedigitaloctopus / pushstage()
Created March 3, 2022 13:51 — forked from davemac/pushstage()
push a local WP database to an existing staging site
# push a local WP database to an existing staging site
# uses current directory as theme path and ssh alias
pushstage() {
START=$(date +%s)
# make a backup of the current local database
# get current directory name, used for database and URL
current=${PWD##*/}
cd ~/Sites/$current || return
# rsync the local database to staging site
// functions.php //
function custom_post_excerpt_length($post_excerpt, $post)
{
$length = 70;
$excerpt = strlen($post_excerpt) > $length ? mb_substr($post_excerpt, 0, $length - 3, "utf-8") . "..." : $post_excerpt;
return $excerpt;
}
add_filter('get_the_excerpt', 'custom_post_excerpt_length', 20, 2);
// end functions.php //
@davemac
davemac / pushstage()
Last active March 3, 2022 13:51
push a local WP database to an existing staging site
# push a local WP database to an existing staging site
# uses current directory as theme path and ssh alias
pushstage() {
START=$(date +%s)
# make a backup of the current local database
# get current directory name, used for database and URL
current=${PWD##*/}
cd ~/Sites/$current || return
# rsync the local database to staging site
@keesiemeijer
keesiemeijer / setup-phpunit.sh
Last active October 16, 2025 20:56
Setup PHPUnit for use in the Local by Flywheel app
#!/usr/bin/env bash
# ===============================================================================
# Script to install PHPUnit in the Local by Flywheel Mac app
# These packages are installed
#
# PHPUnit, curl wget, rsync, git, subversion and composer.
#
# WordPress is installed in the `/tmp/wordpress` directory for use by PHPUnit.
# The WordPress test suite is installed in the `/tmp/wordpress-tests-lib` directory.