hihi

#!/bin/bash

# -----------------------------
# 1. Menu name and base URL
# -----------------------------
menu_name="python-learning-menu"
base_url="https://coder-cafe.com/category/python"

# -----------------------------
# 2. Create new menu
# -----------------------------
wp menu create "$menu_name"
echo "✅ Menu '$menu_name' created."

# -----------------------------
# 3. Fetch menu ID using grep
# -----------------------------
menu_id=$(wp menu list --format=csv | grep "$menu_name" | cut -d',' -f1)
echo "Menu ID is: $menu_id"

# -----------------------------
# 4. Learning sequence categories
# -----------------------------
category_slugs=(
"python-basic"
"python3-basic-tutorials"
"python3-tutorial"
"python-tutorial"
"python-top-tutorials"
"python-ask-answer"
"python-operators"
"python-case-conversion"
"python-built-in-math-functions"
"python-math-methods"
"python-bool-methods"
"python_data_structure"
"python-list-methods"
"python-dictionary-tutorials"
"python-dictionary-method"
"python-functions-reference"
"python-functional-programming"
"python-string"
"python-string-alignment_methods"
"python-string-find-and-replace"
"python-string-split-and-join"
"python-text-processing"
"python-file-tutorials"
"python-file-methods"
"python-os-module"
"python-os-file-directory-methods"
"python-data-compression-module"
"python-random-module"
"python-pytest"
"python-json"
"python-pillow"
"python-pil"
"python-xlsxwriter"
"python_network_programming"
"python_web_scraping"
"beautiful-soup"
"python_forensics"
"python-digital-forensics"
"python_blockchain"
"python_deep_learning"
"python_design_patterns"
"logistic_regression_in_python"
"python-examples"
"python-examples-python"
"python-format-strings"
"rxpy"
"scipy-tutorials"
"seaborn-tutorials"
)

# -----------------------------
# 5. Add categories as menu items
# -----------------------------
for slug in "${category_slugs[@]}"; do
wp menu item add-custom "$menu_id" "$slug" "$base_url/$slug/"
done

echo "✅ All categories added in learning sequence!"

# -----------------------------
# 6. Assign menu to primary location (optional)
# -----------------------------
wp menu location assign "$menu_id" primary
echo "✅ Menu assigned to primary location!"

Leave a Reply

Your email address will not be published. Required fields are marked *