WordPress Plugin Shortcodes
Phytopedia provides several shortcodes to display content on your WordPress site.
Available Shortcodes
1. Category Grid
Display all available categories as a card grid.
[phytopedia_categories]
Example Output:
- Displays all 11 categories (4 free + 7 premium)
- Shows category icon, name, and description
- Clickable cards that navigate to category page
- Responsive grid layout
Parameters: None
2. Article Grid
Display articles from all categories or a specific category.
[phytopedia_articles]
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
category | string | all | Category slug to filter by |
limit | number | 12 | Number of articles to show |
view | string | grid | Display mode: grid or list |
Examples:
// Show all articles (default 12)
[phytopedia_articles]
// Show 20 articles in list view
[phytopedia_articles limit="20" view="list"]
// Show only cannabis articles
[phytopedia_articles category="cannabis" limit="9"]
// Show hemp articles in grid view
[phytopedia_articles category="hemp" view="grid"]
3. Single Article
Display a specific article by its slug.
[phytopedia_article slug="article-slug"]
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
slug | string | Yes | The article slug (URL-friendly name) |
Example:
[phytopedia_article slug="benefits-of-cbd-oil"]
Output:
- Full article content with formatted HTML
- Featured image (if available)
- Author and publish date
- Category breadcrumb navigation
- Social sharing buttons
4. Daily Fact
Display an educational fact - random or today's fact.
[phytopedia_daily_fact]
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
random | string | yes | Show random fact (yes) or today's fact (no) |
category | string | all | Filter by category slug |
Examples:
// Random fact from any category
[phytopedia_daily_fact]
// Today's fact
[phytopedia_daily_fact random="no"]
// Random cannabis fact
[phytopedia_daily_fact random="yes" category="cannabis"]
// Random hemp fact
[phytopedia_daily_fact category="hemp"]
Output:
- Beautiful card with gradient background
- Emoji icon
- Fact text
- Category badge
- Automatically refreshes daily
5. Search Widget
Display a search box for Phytopedia content.
[phytopedia_search]
Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
placeholder | string | "Search articles..." | Search box placeholder text |
Examples:
// Default search box
[phytopedia_search]
// Custom placeholder
[phytopedia_search placeholder="Find educational content..."]
Output:
- Search input field
- Search button
- Live search results
- Filters by title and content
Shortcode Combinations
Knowledge Hub Page
Create a comprehensive knowledge hub by combining shortcodes:
<!-- Hero section -->
<h1>Phytopedia Knowledge Hub</h1>
<p>Explore our educational content library</p>
<!-- Daily fact -->
[phytopedia_daily_fact]
<!-- Search -->
[phytopedia_search]
<!-- Categories -->
<h2>Browse by Category</h2>
[phytopedia_categories]
<!-- Recent articles -->
<h2>Recent Articles</h2>
[phytopedia_articles limit="6"]
Category Landing Page
Create a dedicated page for a specific category:
<!-- Cannabis category page -->
<h1>Cannabis Education</h1>
[phytopedia_daily_fact category="cannabis"]
[phytopedia_articles category="cannabis" limit="12"]
Sidebar Widgets
Add these to your theme's sidebar:
<!-- Daily fact widget -->
[phytopedia_daily_fact random="yes"]
<!-- Search widget -->
[phytopedia_search placeholder="Search..."]
Styling Shortcodes
Custom CSS Classes
All shortcodes output HTML with CSS classes you can target:
/* Category grid */
.phytopedia-categories {
/* Your styles */
}
/* Article grid */
.phytopedia-articles-grid {
/* Your styles */
}
/* Daily fact card */
.phytopedia-daily-fact {
/* Your styles */
}
/* Search widget */
.phytopedia-search {
/* Your styles */
}
Example Customizations
Change category card colors:
.phytopedia-category-card {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 12px;
}
Adjust article grid spacing:
.phytopedia-articles-grid {
gap: 24px;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
Style daily fact widget:
.phytopedia-daily-fact {
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
padding: 2rem;
border-radius: 16px;
box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}
Advanced Usage
Programmatic Shortcode Rendering
Use shortcodes in PHP templates:
<?php
// In your theme file
echo do_shortcode('[phytopedia_categories]');
?>
Conditional Display
Show different shortcodes based on user role:
<?php
if (current_user_can('subscriber')) {
echo do_shortcode('[phytopedia_articles category="cannabis" limit="3"]');
} else {
echo do_shortcode('[phytopedia_categories]');
}
?>
Custom Page Templates
Create a custom page template with Phytopedia content:
<?php
/*
Template Name: Phytopedia Hub
*/
get_header();
?>
<div class="phytopedia-hub">
<?php echo do_shortcode('[phytopedia_daily_fact]'); ?>
<?php echo do_shortcode('[phytopedia_search]'); ?>
<?php echo do_shortcode('[phytopedia_categories]'); ?>
</div>
<?php get_footer(); ?>
Shortcode Parameters Reference
Data Types
- string: Text value (use quotes:
category="cannabis") - number: Numeric value (no quotes:
limit="12"orlimit=12) - boolean: yes/no or true/false (use quotes:
random="yes")
Common Mistakes
❌ Wrong:
[phytopedia_articles category=cannabis] // Missing quotes
[phytopedia_daily_fact random=true] // Use "yes" not "true"
[phytopedia_article] // Missing required slug parameter
✅ Correct:
[phytopedia_articles category="cannabis"]
[phytopedia_daily_fact random="yes"]
[phytopedia_article slug="my-article"]
Troubleshooting
Shortcode Shows as Text
Problem: Shortcode appears as [phytopedia_articles] on page
Solution:
- Ensure plugin is activated
- Check for typos in shortcode name
- Make sure you're in Text editor (not Visual)
- Clear WordPress cache
No Content Displayed
Problem: Shortcode renders but shows no content
Solution:
- Check API connection: Phytopedia → Settings → Connection
- Click Test API Connection
- Sync categories: Click Sync Categories Now
- Check license is active
Broken Layout
Problem: Content displays but layout is broken
Solution:
- Hard refresh:
Ctrl+Shift+RorCmd+Shift+R - Clear WordPress cache
- Check for CSS conflicts with theme
- Disable other plugins temporarily
Need Help?
- 📧 Email: info@trusttechdigital.com
- 📚 Documentation: docs.phytopedia.co
- 🐛 Bug Reports: GitHub Issues
Plugin Version: 2.2.1 Last Updated: November 2025