Custom Templates Guide

📝 Custom Templates Guide
Master HTML structure for your automated posts

🎯 What Are Templates?

Templates let you control the HTML structure of posts created by the plugin. Instead of just dumping AI-generated content into WordPress, you can wrap it in custom HTML with specific formatting, styling, and layout.

🤔 How Templates Work

The Process:

  1. Plugin fetches content (from RSS, YouTube, or Podcast)
  2. AI rewrites it (if enabled)
  3. Template applies → Wraps content in your custom HTML
  4. Post is created with your custom formatting

Simple Example:

Without Template:

[Post content goes here as plain text]

With Template:

<article class="my-custom-post">
    <div class="content">
        [Post content goes here]
    </div>
    <footer>
        <p>Source: <a href="...">Original Article</a></p>
    </footer>
</article>

🎨 Template Variables

Templates use variables that get replaced with actual content:

Core Variables:

Variable What It Becomes Example
{{title}} Post title “10 Tips for WordPress”
{{content}} AI-generated content Full post content
{{excerpt}} Post excerpt First 55 words
{{author}} Author name “John Smith”
{{author_bio}} Author biography “John is a WordPress dev…”
{{date}} Post date “October 7, 2025”
{{time}} Post time “3:45 pm”
{{categories}} Category names “Tech, WordPress”
{{source_title}} Original source title Original article headline
{{source_url}} Original source URL https://example.com/…
{{source_date}} Source publish date When it was published
{{year}} Current year “2025”
{{site_name}} Your site name “My Blog”

📦 Available Presets

The plugin includes 5 ready-made templates:

1. Default

Simple, clean layout with just content and source link.

2. Minimal

Ultra-simple: just content and a small source attribution.

3. Professional Blog

Full article layout with header, author info, and footer.

4. News Article

News-style layout with timestamp and categories.

5. Card Style

Modern card layout with emoji icons.

Preset #2: Minimal

{{content}}

<p><em>Source: <a href="{{source_url}}">{{source_title}}</a></em></p>

Preset #3: Professional Blog

Includes: Post title, Author name and date, Full content, Author bio, Source attribution

<article class="blog-post">
    <header class="post-header">
        <h1>{{title}}</h1>
        <div class="post-meta">
            <span class="author">By {{author}}</span>
            <span class="date">{{date}}</span>
        </div>
    </header>

    <div class="post-content">
        {{content}}
    </div>

    <footer class="post-footer">
        <div class="source-attribution">
            <p><strong>Original Source:</strong> 
               <a href="{{source_url}}">{{source_title}}</a></p>
        </div>
        <div class="author-bio">
            <p><strong>About the Author:</strong> {{author_bio}}</p>
        </div>
    </footer>
</article>

Preset #4: News Article

Includes: Date and time stamp, Categories, Content, Source with copyright

<div class="news-article">
    <div class="article-meta">
        <time datetime="{{date}}">{{date}}</time>
        <span class="categories">Filed under: {{categories}}</span>
    </div>

    <div class="article-body">
        {{content}}
    </div>

    <div class="article-footer">
        <p><strong>Source:</strong> 
           <a href="{{source_url}}">{{source_title}}</a></p>
        <p>© {{year}} {{site_name}}</p>
    </div>
</div>

Preset #5: Card Style

Includes: Card header, Excerpt box, Full content, Meta info with emojis, “View Original” link

<div class="content-card">
    <div class="card-header">
        <h2>{{title}}</h2>
    </div>
    <div class="card-body">
        <div class="excerpt">
            {{excerpt}}
        </div>
        <div class="content">
            {{content}}
        </div>
    </div>
    <div class="card-footer">
        <div class="meta">
            <span>📅 {{date}}</span>
            <span>✍️ {{author}}</span>
        </div>
        <a href="{{source_url}}">View Original →</a>
    </div>
</div>

🎯 How to Use Templates

1
Enable Templates for Campaign

  1. Create or edit a campaign
  2. Scroll to “Custom Post Template” section
  3. Check the box: “Use custom post template for this campaign”
  4. The template editor will appear

2
Load a Preset (Easiest Way)

  1. Select a preset from dropdown
  2. Click “Load” button
  3. Template code appears in the text area
  4. Edit it or use as-is

3
Customize (Optional)

Edit the template code to:

  • Add your own CSS classes
  • Change the HTML structure
  • Rearrange elements
  • Add/remove variables
  • Add custom text

4
Save Campaign

Click “Create Campaign” or “Update Campaign” – your template is saved!


💡 Practical Examples

Example 1: Add a Custom Banner

<div style="background: #f0f0f0; padding: 20px; border-left: 4px solid #0073aa;">
    <p><strong>📢 This content was curated by AI Auto Poster</strong></p>
</div>

{{content}}

<p><em>Source: <a href="{{source_url}}">{{source_title}}</a></em></p>

Example 2: Add Call-to-Action

{{content}}

<div style="background: #e7f5ff; padding: 15px; margin-top: 20px; 
            border-radius: 5px;">
    <p><strong>👉 Want more content like this?</strong></p>
    <p><a href="/subscribe">Subscribe to our newsletter</a></p>
</div>

<p><small>Source: <a href="{{source_url}}">{{source_title}}</a></small></p>

Example 3: Two-Column Layout

<div style="display: flex; gap: 20px;">
    <div style="flex: 2;">
        {{content}}
    </div>
    <div style="flex: 1; background: #f9f9f9; padding: 15px;">
        <h3>About This Post</h3>
        <p><strong>Published:</strong> {{date}}</p>
        <p><strong>Author:</strong> {{author}}</p>
        <p><strong>Categories:</strong> {{categories}}</p>
        <hr>
        <p><a href="{{source_url}}">Read Original →</a></p>
    </div>
</div>

Example 4: Podcast Episode Template

<div class="podcast-post">
    <div class="episode-header">
        <h1>🎙️ {{title}}</h1>
        <p class="episode-meta">Published on {{date}}</p>
    </div>

    <div class="episode-player">
        <!-- Audio player automatically added by plugin if enabled -->
    </div>

    <div class="episode-description">
        <h2>Episode Description</h2>
        {{content}}
    </div>

    <div class="episode-footer">
        <p><strong>Listen on:</strong> 
           <a href="{{source_url}}">{{source_title}}</a></p>
    </div>
</div>

🔧 Templates vs Settings

Q: “Is this the same as in Settings?”

No, they’re different!

Feature Campaign Templates Settings
Scope Per-campaign Site-wide
Purpose Custom HTML structure for posts General plugin settings
When Used When creating posts from THIS campaign All the time
Can Override Yes, overrides defaults Sets the defaults

Example Use Case:

  • Campaign 1 (Tech News): Uses “News Article” template
  • Campaign 2 (Podcast): Uses custom podcast template
  • Campaign 3 (Blog Posts): Uses “Professional Blog” template

🐛 Fixed: Load Button Issue

The Problem:

The “Load” button didn’t work because of a nonce mismatch.

What Was Wrong:

  • JavaScript sent nonce created with name 'aap_admin_nonce'
  • AJAX handler checked for nonce with name 'aap_admin'
  • Names didn’t match → Security check failed → Button did nothing

The Fix (v9.0.1-FINAL2):

Changed nonce creation to use 'aap_admin' so it matches what the AJAX handler expects.

Now the Load button works!


💡 Tips & Best Practices

1. Start with a Preset

Don’t write from scratch – load a preset and customize it.

2. Keep It Simple

Complex templates can break. Start simple, add complexity gradually.

3. Use CSS Classes

Add classes to elements so you can style them with your theme’s CSS.

4. Test Variables First

Make sure a variable works before building complex layouts around it.

5. Validate HTML

Use an HTML validator to check your template syntax.

6. Backup Templates

Copy your template code to a text file before making major changes.


🆘 Troubleshooting

“Load button doesn’t work”

Solution: Use v9.0.1-FINAL2 (has nonce fix)

“Variables don’t replace”

Check:

  • Variable name is correct: {{content}} not {content}
  • Variable is spelled correctly
  • Variable exists (check list above)

“Template breaks my site”

Check:

  • HTML is valid (no unclosed tags)
  • No PHP code (templates are HTML only)
  • No JavaScript errors

“Template looks wrong”

Check:

  • Your theme’s CSS might be conflicting
  • Try adding more specific CSS classes
  • Check mobile view too

📚 Summary

What Templates Do:

  • Control HTML structure of automated posts
  • Let you customize layout per campaign
  • Use variables that get replaced with actual content

How to Use:

  1. Enable templates for campaign
  2. Load a preset
  3. Customize if needed
  4. Save campaign

5 Presets Available:

  1. Default
  2. Minimal
  3. Professional Blog
  4. News Article
  5. Card Style

Key Variables:

  • {{title}} – Post title
  • {{content}} – AI-generated content
  • {{source_url}} – Original source
  • {{author}} – Author name
  • {{date}} – Publish date

Fixed in v9.0.1-FINAL2:

  • ✅ Load button now works
  • ✅ Nonce mismatch resolved

Ready to use templates! 🎨
Start creating beautiful, structured posts today

Leave a Reply

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