Make wp nav functions use wp-cli

master
Jonathan Hodgson 6 years ago
parent dddb87b02c
commit 61059cdebd
  1. 53
      config/oh-my-zsh/functions.zsh

@ -43,17 +43,17 @@ function createLetter(){
fi fi
} }
#Takes you to the aquarius theme #Takes you to the parent theme
function aquarius() { function ptheme() {
public_html=${PWD%/public_html*}/public_html public_html=${PWD%/public_html*}/public_html
if [ -d $public_html ]; then if [ -d $public_html ]; then
theme=$public_html/wp-content/themes theme=$(dirname $(wp --path="$public_html" theme path $(wp --path="$public_html" theme list | grep "parent" | awk '{print $1}')))
if [ -d $theme ]; then if [ -d $theme ]; then
if [ -d "$theme/aquarius" ]; then if [ -d "$theme" ]; then
cdlc $theme/aquarius cd $theme
else else
cdlc $theme/theme_aquarius echo " Can't find theme folder "
fi fi
else else
echo " Can't find theme folder " echo " Can't find theme folder "
fi fi
@ -66,10 +66,9 @@ function aquarius() {
function theme() { function theme() {
public_html=${PWD%/public_html*}/public_html public_html=${PWD%/public_html*}/public_html
if [ -d $public_html ]; then if [ -d $public_html ]; then
theme=$public_html/wp-content/themes theme=$(dirname $(wp --path="$public_html" theme path $(wp --path="$public_html" theme list | grep "active" | grep -v "inactive" | awk '{print $1}')))
if [ -d $theme ]; then if [ -d $theme ]; then
child=$(ls -d $theme/*/ | grep -v "$theme\/theme-aquarius" | grep -v "$theme\/aquarius" | grep -v "$theme\/twenty*" | grep -v "$theme\/barelycorporate" -m 1) cd $theme
cdlc $child
else else
echo " Can't find theme folder " echo " Can't find theme folder "
fi fi
@ -82,10 +81,14 @@ function theme() {
function js() { function js() {
public_html=${PWD%/public_html*}/public_html public_html=${PWD%/public_html*}/public_html
if [ -d $public_html ]; then if [ -d $public_html ]; then
theme=$public_html/wp-content/themes theme=$(dirname $(wp --path="$public_html" theme path $(wp --path="$public_html" theme list | grep "active" | grep -v "inactive" | awk '{print $1}')))
if [ -d $theme ]; then if [ -d $theme ]; then
child=$(ls -d $theme/*/ | grep -v "$theme\/theme-aquarius" | grep -v "$theme\/aquarius" | grep -v "$theme\/twenty*" | grep -v "$theme\/barelycorporate" -m 1) if [ -d "$theme/js" ]; then
cdlc $child/js/ cd "$theme/js"
else
echo "Can't find a JS folder. Here is the theme"
cd "$theme"
fi
else else
echo " Can't find theme folder " echo " Can't find theme folder "
fi fi
@ -98,10 +101,14 @@ function js() {
function css() { function css() {
public_html=${PWD%/public_html*}/public_html public_html=${PWD%/public_html*}/public_html
if [ -d $public_html ]; then if [ -d $public_html ]; then
theme=$public_html/wp-content/themes theme=$(dirname $(wp --path="$public_html" theme path $(wp --path="$public_html" theme list | grep "active" | grep -v "inactive" | awk '{print $1}')))
if [ -d $theme ]; then if [ -d $theme ]; then
child=$(ls -d $theme/*/ | grep -v "$theme\/theme-aquarius" | grep -v "$theme\/aquarius" | grep -v "$theme\/twenty*" | grep -v "$theme\/barelycorporate" -m 1) if [ -d "$theme/css" ]; then
cdlc $child/css/ cd "$theme/css"
else
echo "Can't find a CSS folder. Here is the theme"
cd "$theme"
fi
else else
echo " Can't find theme folder " echo " Can't find theme folder "
fi fi
@ -114,12 +121,7 @@ function css() {
function plugins() { function plugins() {
public_html=${PWD%/public_html*}/public_html public_html=${PWD%/public_html*}/public_html
if [ -d $public_html ]; then if [ -d $public_html ]; then
plugins=$public_html/wp-content/plugins cd $(wp --path="$public_html" plugin path)
if [ -d $plugins ]; then
cdlc $plugins
else
echo " Can't find plugins folder "
fi
else else
echo " Can't find public_html folder." echo " Can't find public_html folder."
fi fi
@ -129,12 +131,7 @@ function plugins() {
function themes() { function themes() {
public_html=${PWD%/public_html*}/public_html public_html=${PWD%/public_html*}/public_html
if [ -d $public_html ]; then if [ -d $public_html ]; then
themes=$public_html/wp-content/themes cd $(wp --path="$public_html" theme path)
if [ -d $themes ]; then
cdlc $themes
else
echo " Can't find theme folder "
fi
else else
echo " Can't find public_html folder." echo " Can't find public_html folder."
fi fi

Loading…
Cancel
Save