Convert make-council-pages.sh script to use php script

This commit is contained in:
2024-07-30 23:01:54 +10:00
parent cd9135e3bd
commit 89c87d942d
3 changed files with 13 additions and 40 deletions

View File

@@ -18,14 +18,20 @@ function create_or_update_page() {
short_name=$(echo "$council_block" | jq -r '.shortName')
content=$(echo "$council_block" | jq -c | gomplate -d config=stdin:///in.json -f page-template)
content=$(echo "$council_block" | jq -c | php php-template/main.php)
if [ $? -eq 0 ]; then
if [[ -n "$page_id" ]]; then
echo "Update page $short_name (post $page_id)"
echo "$content" | wp post update "$page_id" --post_content="$content" $WP_FLAGS -
else
echo "Create page $short_name"
echo "$content" | wp post create --post_type=page --post_title="$short_name" --post_status=publish $WP_FLAGS -
fi
if [[ -n "$page_id" ]]; then
echo "Update page $short_name (post $page_id)"
echo "$content" | wp post update "$page_id" --post_content="$content" $WP_FLAGS -
else
echo "Create page $short_name"
echo "$content" | wp post create --post_type=page --post_title="$short_name" --post_status=publish $WP_FLAGS -
echo "Failed to generate page content for $short_name"
fi
}