-
Notifications
You must be signed in to change notification settings - Fork 0
CommandCreateShortcode
rogertm edited this page Apr 8, 2026
·
1 revision
Crea una clase de Shortcode y también su template en templates/shortcodes/.
create:shortcode [options] [--] <name> [<project>]-
nameNombre del shortcode (ej:"Photo Gallery"). -
projectSlug del proyecto destino (ej:wasp-child). Si se omite, usawasp.
-
--dry-runSimula la creación. -
-h, --helpMuestra la ayuda.
php cli/wasp create:shortcode "Photo Gallery"
php cli/wasp create:shortcode "Photo Gallery" "wasp-child"
php cli/wasp create:shortcode "Photo Gallery" --dry-run- Crea clase en
classes/shortcode/class-{project}-shortcode-photo-gallery.php.- Ejemplo en WASP:
wasp/classes/shortcode/class-wasp-shortcode-photo-gallery.php
- Ejemplo en WASP:
- Crea template en
templates/shortcodes/{project}_photo_gallery.php.- Ejemplo en WASP:
wasp/templates/shortcodes/wasp_photo_gallery.php
- Ejemplo en WASP:
- Registra en
inc/classes.php:
new {Namespace}\Shortcode\Shortcode_Photo_Gallery;class Shortcode_Photo_Gallery extends Shortcode
{
public function __construct()
{
$this->shortcode_tag = 'wasp_photo_gallery';
}
}Puedes sobreescribir el template generado creando:
wp-content/themes/your-theme/shortcodes/wasp_photo_gallery.php