# WordPress Blog Update Instructions

This document contains instructions for creating and updating blog posts on the XGamingServer WordPress site.

## WP-CLI Basics

All commands are run from the server with access to WP-CLI. The WordPress installation is typically at `/var/www/wordpress` or similar.

### Creating a New Post

```bash
wp post create \
  --post_title="Your Post Title Here" \
  --post_content="<p>Your HTML content here...</p>" \
  --post_status="publish" \
  --post_author=1 \
  --post_category=CATEGORY_ID
```

### Updating an Existing Post

```bash
wp post update POST_ID \
  --post_content="<p>Updated HTML content...</p>"
```

### Getting Post Content

```bash
wp post get POST_ID --field=post_content
```

### Listing Posts

```bash
# List recent posts
wp post list --post_type=post --posts_per_page=20

# List posts in a specific category
wp post list --post_type=post --category=CATEGORY_ID
```

---

## Category IDs

| Game | Category ID |
|------|-------------|
| Hytale | 115 |
| StarRupture | 114 |
| Minecraft | (check with `wp term list category`) |

To find category IDs:
```bash
wp term list category --fields=term_id,name,slug
```

---

## Featured Images

### Setting a Featured Image

```bash
wp post meta update POST_ID _thumbnail_id ATTACHMENT_ID
```

### Finding Attachment IDs

```bash
# List media attachments
wp post list --post_type=attachment --posts_per_page=50

# Search for specific image
wp post list --post_type=attachment --s="hytale"
```

### Current Featured Image IDs

| Game | Attachment ID |
|------|---------------|
| Hytale | 20951 |
| StarRupture | (check media library) |

---

## CTA Banner Templates

### Hytale CTA Banner

```html
<div style="background: linear-gradient(135deg, rgba(0,0,0,0.8) 0%, rgba(0,40,70,0.9) 100%), url('https://xgamingserver.com/img/hytale-server-hosting.avif'); background-size: cover; background-position: center; padding: 30px; border-radius: 12px; margin-bottom: 30px; border: 2px solid #00d4ff; box-shadow: 0 8px 32px rgba(0,212,255,0.25);">
<h3 style="color: #00d4ff; margin-top: 0;">Ready for Hytale?</h3>
<p style="color: #fff;">Get a fully managed Hytale server with instant setup, automatic updates, and 24/7 support. Focus on playing while we handle the technical details.</p>
<p><a href="https://xgamingserver.com/hytale-server-hosting" style="display: inline-block; background: linear-gradient(90deg, #00d4ff 0%, #00a8cc 100%); color: #000; padding: 14px 28px; text-decoration: none; border-radius: 8px; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; box-shadow: 0 4px 15px rgba(0,212,255,0.4); transition: all 0.3s ease;">Get Hytale Server Hosting →</a></p>
</div>
```

### StarRupture CTA Banner

```html
<div style="background: linear-gradient(135deg, rgba(0,0,0,0.8) 0%, rgba(40,0,70,0.9) 100%), url('https://xgamingserver.com/img/starrupture-server-hosting.avif'); background-size: cover; background-position: center; padding: 30px; border-radius: 12px; margin-bottom: 30px; border: 2px solid #a855f7; box-shadow: 0 8px 32px rgba(168,85,247,0.25);">
<h3 style="color: #a855f7; margin-top: 0;">Ready for StarRupture?</h3>
<p style="color: #fff;">Get a fully managed StarRupture server with instant setup, automatic updates, and 24/7 support. Focus on playing while we handle the technical details.</p>
<p><a href="https://xgamingserver.com/starrupture-server-hosting" style="display: inline-block; background: linear-gradient(90deg, #a855f7 0%, #7c3aed 100%); color: #fff; padding: 14px 28px; text-decoration: none; border-radius: 8px; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; box-shadow: 0 4px 15px rgba(168,85,247,0.4); transition: all 0.3s ease;">Get StarRupture Server Hosting →</a></p>
</div>
```

### Generic CTA Template (Customize Colors)

```html
<div style="background: linear-gradient(135deg, rgba(0,0,0,0.8) 0%, rgba(R,G,B,0.9) 100%), url('IMAGE_URL'); background-size: cover; background-position: center; padding: 30px; border-radius: 12px; margin-bottom: 30px; border: 2px solid #ACCENT_COLOR; box-shadow: 0 8px 32px rgba(R,G,B,0.25);">
<h3 style="color: #ACCENT_COLOR; margin-top: 0;">HEADING</h3>
<p style="color: #fff;">DESCRIPTION TEXT</p>
<p><a href="LANDING_PAGE_URL" style="display: inline-block; background: linear-gradient(90deg, #ACCENT_COLOR 0%, #DARKER_ACCENT 100%); color: #000; padding: 14px 28px; text-decoration: none; border-radius: 8px; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; box-shadow: 0 4px 15px rgba(R,G,B,0.4); transition: all 0.3s ease;">CTA TEXT →</a></p>
</div>
```

---

## Blog Post Structure

### Recommended Structure

1. **Introduction** (1-2 paragraphs)
2. **Main Content** (H2 sections with steps/info)
3. **CTA Banner** (place after intro or before conclusion)
4. **Conclusion** (summary + call to action)

### HTML Formatting

```html
<h2>Section Heading</h2>
<p>Paragraph text...</p>

<h3>Subsection</h3>
<ul>
<li>List item 1</li>
<li>List item 2</li>
</ul>

<pre><code>Code block content</code></pre>

<strong>Bold text</strong>
<em>Italic text</em>
```

---

## Complete Example: Creating a New Post

```bash
# 1. Create the post
wp post create \
  --post_title="How to Configure Your Hytale Server" \
  --post_content="<p>Introduction paragraph...</p>

<div style=\"background: linear-gradient(135deg, rgba(0,0,0,0.8) 0%, rgba(0,40,70,0.9) 100%), url('https://xgamingserver.com/img/hytale-server-hosting.avif'); background-size: cover; background-position: center; padding: 30px; border-radius: 12px; margin-bottom: 30px; border: 2px solid #00d4ff; box-shadow: 0 8px 32px rgba(0,212,255,0.25);\">
<h3 style=\"color: #00d4ff; margin-top: 0;\">Ready for Hytale?</h3>
<p style=\"color: #fff;\">Get a fully managed Hytale server with instant setup, automatic updates, and 24/7 support.</p>
<p><a href=\"https://xgamingserver.com/hytale-server-hosting\" style=\"display: inline-block; background: linear-gradient(90deg, #00d4ff 0%, #00a8cc 100%); color: #000; padding: 14px 28px; text-decoration: none; border-radius: 8px; font-weight: bold;\">Get Hytale Server Hosting →</a></p>
</div>

<h2>Step 1: Download Server Files</h2>
<p>Content here...</p>

<h2>Conclusion</h2>
<p>Final paragraph...</p>" \
  --post_status="publish" \
  --post_author=1 \
  --post_category=115

# 2. Note the returned post ID (e.g., 20970)

# 3. Set the featured image
wp post meta update 20970 _thumbnail_id 20951
```

---

## Troubleshooting

### Post Content Not Updating

If content appears truncated or corrupted:
1. Use heredoc syntax for long content
2. Escape special characters properly
3. Check for unmatched quotes

```bash
wp post update POST_ID --post_content="$(cat <<'EOF'
<p>Your content here...</p>
EOF
)"
```

### Finding Post by Title

```bash
wp post list --post_type=post --s="search term" --fields=ID,post_title
```

### Viewing Post Revisions

```bash
wp post list --post_type=revision --post_parent=POST_ID
```

### Restoring from Revision

```bash
# Get revision content
wp post get REVISION_ID --field=post_content > backup.html

# Update original post with revision content
wp post update ORIGINAL_POST_ID --post_content="$(cat backup.html)"
```

---

## Image Files Location

Background images for CTA banners are stored in:
- `/var/www/xgamingserver.com/img/`

Example paths:
- `https://xgamingserver.com/img/hytale-server-hosting.avif`
- `https://xgamingserver.com/img/starrupture-server-hosting.avif`

---

## Landing Page Product IDs

When updating landing page billing links, use these product IDs:

| Plan | Hytale Product ID |
|------|-------------------|
| Starter/Novice | 550 |
| Explorer | 551 |
| Creator | 552 |
| Community | 553 |
| Ultimate | 554 |

Link format:
```
https://billing.xgamingserver.com/index.php?rp=/store/game-servers/&pid=PRODUCT_ID
```

---

## SEO Best Practices

1. **Title**: Include main keyword, 50-60 characters
2. **Content**: 400-600 words minimum
3. **Headings**: Use H2 for main sections, H3 for subsections
4. **Keywords**: Include target keywords naturally
5. **Internal Links**: Link to landing page via CTA banner
6. **Featured Image**: Always set for social sharing

---

## Quick Reference Commands

```bash
# Create post
wp post create --post_title="Title" --post_content="Content" --post_status="publish" --post_category=ID

# Update post
wp post update POST_ID --post_content="New content"

# Set featured image
wp post meta update POST_ID _thumbnail_id ATTACHMENT_ID

# List categories
wp term list category

# List recent posts
wp post list --posts_per_page=20

# Get post content
wp post get POST_ID --field=post_content
```
