Adding an object

To add your shortcode to MotoPress Content Editor interface you need to “describe” it first. To do that, create an instance of MPCEObject like this:

$youShortcodeObj = new MPCEObject( $id, $name, $icon, $attributes, $position, $closeType, $resize );

Object parameters

(string) (required) The $id should match with your shortcode tag name.
Default: None

(string) (required) Specifies the name of the object in the MotoPress Content Editor interface.
Default: None

(string) (required) path to the object icon within the wp-content folder.
Default: empty string

(array) (required) Multidimensional associative array, where keys are your shortcode attributes and values are associated visual controls.

(string) (required) It defines enclosing or self-closing shortcode type. The value should be one of these constants:

  • MPCEObject::SELF_CLOSED – if your shortcode is self-closed.
  • MPCEObject::ENCLOSED – if your shortcode is enclosed.

Default: MPCEObject::SELF_CLOSED
Read more about enclosing & self-closing shortcodes.

Position of the object.
Default: 0

(string) Sets the ability to resize your object. List of the available options:

  • MPCEObject::RESIZE_NONE – doesn’t allow to resize
  • MPCEObject::RESIZE_HORIZONTAL – allows to resize horizontally
  • MPCEObject::RESIZE_VERTICAL – allows to resize vertically
  • MPCEObject::RESIZE_ALL – allows to resize horizontally and vertically


When your shortcode is completely described you can add it to the one of available groups within the addObject method.

    $motopressCELibrary->addObject($youShortcodeObj, $group = 'other');

List of available groups:

  • text
  • image
  • button
  • media
  • other
  • wordpress

Related Topics

Leave a Reply

Your email address will not be published. Required fields are marked *