Created
October 19, 2021 12:54
-
-
Save michaelbragg/82729bf5fbe9c434d72f814bca24791d to your computer and use it in GitHub Desktop.
[WordPress] Create pages and assign special status
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# `--portcelain` makes the comand return only the ID | |
# `$_` is a special bash command that uses the last comands output. | |
# Run two commands in sequential, as the second command uses the output of the first. | |
echo $(wp post create --post_type="page" --post_title="Home" --post_status="publish" --porcelain) | |
wp option update page_on_front $_ | |
# Run two commands in sequential, as the second cpage_for_posts ommand uses the output of the first. | |
echo $(wp post create --post_type="page" --post_title="Blog" --post_status="publish" --porcelain) | |
wp option update page_for_posts $_ | |
wp option update show_on_front "page" |
If you were to run this as an executable (setup.sh). This line tells the
command line what language to run it as. A bit like adding `<?PHP` to a PHP
file.
As you are running it from the command line. It’s not needed. Just run each
line individually.
On Tue, 19 Oct 2021 at 7:33 pm, Mark Wilkinson ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
What does the comment on line 1 mean please?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/82729bf5fbe9c434d72f814bca24791d#gistcomment-3932639>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHX3LFVCYO6QVAU3N2JFUTUHW2WLANCNFSM5GJZ624Q>
.
--
Michael Bragg
e. ***@***.***
w. https://michaelbragg.com
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What does the comment on line 1 mean please?