@marvalt/shcoder
v0.1.37
Published
Shortcode renderer components for DigiValt CPTs (Members, Testimonials, Projects, etc.)
Downloads
783
Readme
@marvalt/shcoder
Shortcode renderer components for DigiValt Custom Post Types (Members, Testimonials, Projects, etc.)
Documentation
- After install:
node_modules/@marvalt/shcoder/docs/README.md - Requires
wp-custom-api-endpointsWordPress plugin and staticwordpress-data.jsonfrom@marvalt/digivalt-core.
Overview
This package provides React components and hooks for rendering WordPress shortcodes in headless React applications. It works in conjunction with the wp-custom-api-endpoints WordPress plugin, which auto-discovers CPTs and registers shortcodes dynamically.
Installation
npm install @marvalt/shcoderUsage
Components
Member Components
- MemberCard - Displays a single member profile
- MemberCardsGrid - Displays multiple members in a grid layout
- MemberSlideshow - Displays members in a rotating slideshow
Testimonial Components
- TestimonialCard - Displays a single testimonial
- TestimonialCardsGrid - Displays multiple testimonials in a grid layout
- TestimonialSlideshow - Displays testimonials in a rotating slideshow
Hooks
- useMembers - Fetch members based on shortcode attributes
- useMember - Fetch a single member by ID
- useTestimonials - Fetch testimonials based on shortcode attributes
- useTestimonial - Fetch a single testimonial by ID
WordPress Shortcodes
The following shortcodes are automatically registered by the wp-custom-api-endpoints plugin:
Member Shortcodes
[member_card id="123"]- Single member profile[member_cards tax="leadership" cols="3" image="true"]- Member grid[member_slideshow category="leadership" interval="5000" show_bio="true"]- Member slideshow
Testimonial Shortcodes
[testimonial_card id="123"]- Single testimonial[testimonial_cards category="external" cols="2"]- Testimonial grid[testimonial_slideshow category="external" interval="5000"]- Testimonial slideshow
Configuration
Static data is loaded via @marvalt/digivalt-core/static after build-time generation — not live REST from the browser. Include CPT slugs in VITE_ENABLED_POST_TYPES. See docs/ENVIRONMENT.md.
License
GPL-3.0-or-later
