Support » Plugins and Hacks » Does wp-mvc support shortcode and widget ?

Does wp-mvc support shortcode and widget ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • I’ve just added a shortcode functionality patch to my branch on github.

    It’s really simple if I do say so myself – you just need to add a bit of config in your app/config/bootstrap.php which maps a new shortcode to controller/action and substitutes the result of the associated view when displayed.

    There’s even an example in the commit comment here:


    The example might seem slightly complicated because it covers the extra functionality that lets you to specify, in the config, allow_actions and deny_actions. This is because you can specify the action as a parameter to the shortcode to hit any action on the mapped controller.

    But because shortcodes can often be entered by low-privileged users, it makes sense to be able to limit what actions they can perform with a shortcode.

    I can confirm that Davelopware patch works well!

    Also although it doesn’t seem to be documented, wp-mvc can automatically register widgets for you.

    Just create a my-plugin/app/widgets folder and create a php file for each widget, for example my_widget.php.

    Each file should contain a class following the wordpress widget documentation

    Also your widget class name needs to follow the following naming convention: CamelPluginName_CamelWidgetFileName

    In the previous example your class would be named MyPlugin_MyWidget

    Thanks dodmax – great tip on the widgets.

    I know the documentation is a somewhat self-referential example of using wp-mvc itself, but I keep wishing it was a wiki that we could all pitch in with 😐

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Does wp-mvc support shortcode and widget ?’ is closed to new replies.