Custom Page Templates

By using MotoPress WordPress Page Builder you can add your custom Page layouts with action mp_library


function extendTemplates($motopressCELibrary) {
$templateContent = 'paste your shortcodes here'; // example of the content you can find at motopress-content-editor/includes/ce/templates folder

//Add new example of MPCETemplate
$template = new MPCETemplate('my_template', __('Custom Template', 'domain'), $templateContent, 'uploads/my-template.png');

//Add template calling addTemplate method
$motopressCELibrary->addTemplate($template);
}
add_action('mp_library', 'extendTemplates', 11, 1);

MPCETemplate Class

    • id
      (string) – id of new template
      Default: null
    • name
      (string) – name of new template
      Default: null
    • content
      (string) – content of new template
      Default: null
    • icon
      (string) – icon of new template (85x142px). Here you should indicate the path to your icon from /wp_content folder.
      Default: no-template.png

You’ll see your page template while adding new page or post

ce-add-template.jpg

5 Replies to “Custom Page Templates”

    1. Hi Richard,
      Thank you for your feedback and further question. Currently there is no option to edit/remove templates you have created via plugin interface. You can do that via database only. However we have this feature in our to-do list and hope we’ll add this functionality soon. Thanks.

Leave a Reply

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