DEV Community

RAFAEL RAMIREZ
RAFAEL RAMIREZ

Posted on • Edited on

Plugin de WordPress: crea tu blog de brujos con shortcodes

Ever wanted to create a WordPress blog with a magical twist? You know, something that feels like a mix between a tarot table and a blog dashboard? That was me a few weeks ago. I was helping a friend who’s into spells, charms, and all that—and we thought, “Why not build a WordPress plugin just for that vibe?”

Spoiler: it’s not that hard, and it’s kinda fun.

Lectura De Cartas en Dekalb

Why Not Just Use a Theme?

I get it. Themes exist. But plugins give you control—like real control. You can drop elements anywhere with shortcodes, make interactive widgets, or even embed a daily spell.

One friend joked that I was channeling Lectura De Cartas Dekalb through my keyboard. And honestly? It felt like that.

Five Concepts You’ll Need

  • WordPress Plugin Structure
  • Shortcodes (these are magic, literally)
  • Custom CSS & JS (for sparkles? maybe)
  • Widgets (optional, but cool)
  • Hooking into WordPress functions

Let’s dive in.

Step 1: Create Your Plugin Folder

// File: wp-content/plugins/magic-blog/magic-blog.php
<?php
/*
Plugin Name: Magic Blog Shortcodes
Description: Add mystical shortcodes to your posts and pages.
Version: 1.0
Author: You
*/
Enter fullscreen mode Exit fullscreen mode

Step 2: Register a Simple Shortcode

function mb_tarot_card() {
    $cards = ['The Fool', 'The Magician', 'The High Priestess'];
    return "Today's card is: " . $cards[array_rand($cards)];
}
add_shortcode('tarot', 'mb_tarot_card');
Enter fullscreen mode Exit fullscreen mode

Step 3: Load Some Custom CSS

function mb_enqueue_styles() {
    wp_enqueue_style('magic-style', plugin_dir_url(__FILE__) . 'magic.css');
}
add_action('wp_enqueue_scripts', 'mb_enqueue_styles');
Enter fullscreen mode Exit fullscreen mode

Step 4: Add CSS for Mystical Vibes

/* File: magic.css */
.tarot-box {
    background: #1a1a1a;
    color: #f0c674;
    border: 2px dashed purple;
    padding: 1rem;
}
Enter fullscreen mode Exit fullscreen mode

Step 5: Another Shortcode Example

function mb_spell_of_the_day() {
    return "<div class='tarot-box'>Cast courage into your coffee today ☕✨</div>";
}
add_shortcode('spell', 'mb_spell_of_the_day');
Enter fullscreen mode Exit fullscreen mode

Step 6: Optional JavaScript for Random Spells

// File: magic.js
const spells = ['Joy!', 'Patience.', 'Power.'];
document.querySelector('.tarot-box').innerText = spells[Math.floor(Math.random() * spells.length)];
Enter fullscreen mode Exit fullscreen mode

Step 7: Enqueue JS in Plugin

function mb_enqueue_scripts() {
    wp_enqueue_script('magic-js', plugin_dir_url(__FILE__) . 'magic.js', array(), false, true);
}
add_action('wp_enqueue_scripts', 'mb_enqueue_scripts');
Enter fullscreen mode Exit fullscreen mode

Step 8: Style a Widget (Optional)

// Register widget area
function mb_widgets_init() {
    register_sidebar(array(
        'name' => 'Witchy Sidebar',
        'id' => 'witchy-sidebar',
        'before_widget' => '<div class="witch-widget">',
        'after_widget' => '</div>',
    ));
}
add_action('widgets_init', 'mb_widgets_init');
Enter fullscreen mode Exit fullscreen mode

Step 9: Protect Output

function mb_secure_output($text) {
    return esc_html($text);
}
Enter fullscreen mode Exit fullscreen mode

Step 10: Final Touch – Admin Notice

function mb_admin_notice(){
    echo '<div class="notice notice-success"><p>Magic Blog Plugin is activated! 🧙‍♂️</p></div>';
}
add_action('admin_notices', 'mb_admin_notice');
Enter fullscreen mode Exit fullscreen mode

Real-World Use

My friend used this to set up her own blog where she shares moon rituals and daily tarot draws. People legit asked if she knew about Limpieza espiritual Dekalb just from reading the site’s energy.

No joke, one reader even said it felt like it was made by Brujos en Dekalb. Mission accomplished, I guess?

Why You Should Try This

  • You get to flex your PHP muscles
  • Add custom magical content without touching your theme
  • Turn your blog into a spiritual experience
  • Honestly, it’s just fun

Wrap-Up

Give it a try. Make it weird. Make it yours.

You can always add more shortcodes, maybe even a compatibility calculator or a moon-phase banner. Whatever your mystical heart desires.

Just remember: WordPress + code = magic. ✨

Top comments (0)