From c84d5529256ff007321fc4d5c0b5f220d4bb95e1 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Wed, 24 Oct 2018 17:38:48 +0100 Subject: [PATCH] Modify and add to wp nav shortcuts --- shells/aliases | 3 ++- shells/functions | 45 +++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/shells/aliases b/shells/aliases index 77c07237..2ab4d9a2 100644 --- a/shells/aliases +++ b/shells/aliases @@ -76,7 +76,8 @@ alias home="cd ~/" alias ~="cd ~/" #Goes up to the public_html folder -alias ph='cd ${PWD%/public_html*}/public_html' +alias ph='cd ${${PWD%/public_html*}%/wiki*}/public_html' +alias wiki='cd ${${PWD%/public_html*}%/wiki*}/wiki' #Edit wp-config.php using $EDITOR alias conf='$EDITOR ${PWD%/public_html*}/public_html/wp-config.php' diff --git a/shells/functions b/shells/functions index 05d51285..dbe024c1 100644 --- a/shells/functions +++ b/shells/functions @@ -90,7 +90,7 @@ function createFPLreport(){ #Takes you to the parent theme function ptheme() { - public_html=${PWD%/public_html*}/public_html + public_html=${${PWD%/public_html*}%/wiki*}/public_html if [ -d $public_html ]; then if [ -d $public_html/wp ]; then wpPath=$public_html/wp; @@ -113,7 +113,7 @@ function ptheme() { } function get_theme() { - public_html=${PWD%/public_html*}/public_html + public_html=${${PWD%/public_html*}%/wiki*}/public_html if [ -d $public_html ]; then if [ -d $public_html/wp ]; then wpPath=$public_html/wp; @@ -157,7 +157,7 @@ function css() { #Takes you to the plugin directory function plugins() { - public_html=${PWD%/public_html*}/public_html + public_html=${${PWD%/public_html*}%/wiki*}/public_html if [ -d $public_html ]; then if [ -d $public_html/wp ]; then wpPath=$public_html/wp; @@ -170,6 +170,36 @@ function plugins() { fi } +#Takes you to the woocommece plugin directory +function woo() { + public_html=${${PWD%/public_html*}%/wiki*}/public_html + if [ -d $public_html ]; then + if [ -d $public_html/wp ]; then + wpPath=$public_html/wp; + else + wpPath=$public_html; + fi + cd $(dirname $(wp --path="$wpPath" plugin path woocommerce)) + else + echo " Can't find public_html folder." + fi +} + +#Takes you to the woocommerce templates plugin directory +function wooTemplates() { + public_html=${${PWD%/public_html*}%/wiki*}/public_html + if [ -d $public_html ]; then + if [ -d $public_html/wp ]; then + wpPath=$public_html/wp; + else + wpPath=$public_html; + fi + cd $(dirname $(wp --path="$wpPath" plugin path woocommerce))/templates + else + echo " Can't find public_html folder." + fi +} + #Copies a woo tepmplate file to the theme function woocp() { public_html=${PWD%/public_html*}/public_html @@ -206,7 +236,7 @@ function woocp() { #Takes you to the theme directory function themes() { - public_html=${PWD%/public_html*}/public_html + public_html=${${PWD%/public_html*}%/wiki*}/public_html if [ -d $public_html ]; then if [ -d $public_html/wp ]; then wpPath=$public_html/wp; @@ -219,6 +249,13 @@ function themes() { fi } +function todo() { + wikidir=${${PWD%/public_html*}%/wiki*}/wiki + if [ -d "$wikidir" ]; then + $EDITOR "$wikidir/ToDo.md" + fi +} + #This function toggles debug in wp-config function debugToggle(){ public_html=${PWD%/public_html*}/public_html