PHPackages                             wpfulcrum/shortcode - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. wpfulcrum/shortcode

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wpfulcrum/shortcode
===================

Fulcrum Shortcode Module - WordPress shortcodes made easy.

3.0.3(8y ago)010MITPHPPHP ^5.6|^7

Since Dec 11Pushed 8y ago1 watchersCompare

[ Source](https://github.com/wpfulcrum/shortcode)[ Packagist](https://packagist.org/packages/wpfulcrum/shortcode)[ Docs](https://github.com/wpfulcrum/shortcode)[ RSS](/packages/wpfulcrum-shortcode/feed)WikiDiscussions develop Synced 6d ago

READMEChangelogDependencies (7)Versions (6)Used By (0)

Shortcode Module
================

[](#shortcode-module)

[![Build Status](https://camo.githubusercontent.com/2e6fe3fd894c19188b626b9c94b5feab27afc12d203a6cfe626e6aff5e930b8f/68747470733a2f2f7472617669732d63692e6f72672f777066756c6372756d2f73686f7274636f64652e7376673f6272616e63683d646576656c6f70)](https://travis-ci.org/wpfulcrum/shortcode)[![Latest Stable Version](https://camo.githubusercontent.com/c8dc5ecd8604122de2052e40d452a743899d90aca0a9ca66b388369a53824d95/68747470733a2f2f706f7365722e707567782e6f72672f777066756c6372756d2f73686f7274636f64652f762f737461626c65)](https://packagist.org/packages/wpfulcrum/shortcode)[![License](https://camo.githubusercontent.com/7fbd1568d16dfd50f7ca1cbdd7991875920326e4807b63aa29e864892ec10b60/68747470733a2f2f706f7365722e707567782e6f72672f777066756c6372756d2f73686f7274636f64652f6c6963656e7365)](https://packagist.org/packages/wpfulcrum/shortcode)

The Fulcrum Custom Shortcode Module makes your job easier for adding shortcodes to your project. Pass it a configuration, build your view file, and it handles the rest for you.

Features
--------

[](#features)

- Registration is handled for you.
- Merges the user-defined atts with the defaults you specify, i.e. handles `shortcode_atts` for you.
- Renders the view file you specify in the configuration.
- Use the built-in `Shortcode` class or specify a custom one within your configuration file.
- Stores in Fulcrum's Container - when added, automatically stores it in the Container for global usage.

Installation
------------

[](#installation)

The best way to use this component is through Composer:

```
composer require wpfulcrum/shortcode

```

Dependencies
------------

[](#dependencies)

This module requires:

- at least PHP 5.6
- WordPress 4.8+

Configuring a Shortcode
-----------------------

[](#configuring-a-shortcode)

This module, as with all Fulcrum modules, is configuration driven as part of the ModularConfig design pattern. In your theme/plugin's configuration folder, you will want to create a configuration file. Here is the basic structure of that file:

```

```

### Properties Available

[](#properties-available)

The following properties are available for you to use within your view file:

- `$this->attributes` - Array of attributes after merging the user-defined with the defaults using `shortcode_atts`.
- `$this->content` - The content passed into the shortcode, e.g. `[foo]This is the content[/foo]`.

### Methods Available

[](#methods-available)

Some common shortcode attributes are `id` and `class` attributes. You can use the following methods to get either of these for your view:

- `$this->getId()` which escapes and returns ` id="the-id"`.
- `$this->getClass()` which escapes and returns the class attribute, e.g. `foobar`. You can pass a `true` to it to add a space in front of the class attribute, e.g. `$this->getClass()` returns ` foobar`.

Making It Work
--------------

[](#making-it-work)

There are 2 ways to utilize this module:

1. With the full [Fulcrum plugin](https://github.com/wpfulcrum/fulcrum).
2. Or on its own without Fulcrum.

### With Fulcrum

[](#with-fulcrum)

In Fulcrum, your plugin is an Add-on. In your plugin's configuration file, you will have a parameter for the `serviceProviders`, where you list each of the service providers you want to use. In this case, you'll use the `provider.post_type`.

For example, using our Book configuration above, this would be the configuration:

```
	'serviceProviders' => [

		/****************************
		 * Custom Post Types
		 ****************************/
		'foo.shortcode' => array(
			'provider' => 'provider.shortcode', // this is the service provider to be used.
			'config'   => FOO_PLUGIN_DIR . 'config/shortcode/foo.php', // path to the shortcode's configuration file.
		),
	],

```

### Without Fulcrum

[](#without-fulcrum)

Without Fulcrum, you'll need to instantiate each of the dependencies and `Shortcode`. For example, you would do:

```
new Shortcode(
    ConfigFactory::create(FOO_PLUGIN_DIR . 'config/shortcode/foo.php'), // path to the shortcode's configuration file.
);

```

Contributing
------------

[](#contributing)

All feedback, bug reports, and pull requests are welcome.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

4

Last Release

3069d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/01bb38cdf9dc0fc5ed69cd6d114c0ffe27f764bd2eefa62ca38d03f4c8ae8110?d=identicon)[hellofromtonya](/maintainers/hellofromtonya)

---

Top Contributors

[![hellofromtonya](https://avatars.githubusercontent.com/u/7284611?v=4)](https://github.com/hellofromtonya "hellofromtonya (11 commits)")

---

Tags

wordpressshortcode

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/wpfulcrum-shortcode/health.svg)

```
[![Health](https://phpackages.com/badges/wpfulcrum-shortcode/health.svg)](https://phpackages.com/packages/wpfulcrum-shortcode)
```

###  Alternatives

[aristath/kirki

Extending the WordPress customizer

1.3k73.0k4](/packages/aristath-kirki)[afragen/git-updater

A plugin to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted plugins, themes, and language packs.

3.3k1.6k](/packages/afragen-git-updater)[pingpong/shortcode

Laravel - Simple shortcode based on wordpress shortcode

4040.0k1](/packages/pingpong-shortcode)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
