Skip to content

Instantly share code, notes, and snippets.

@mototeam
Created January 10, 2015 10:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mototeam/e757e1df352a9547839f to your computer and use it in GitHub Desktop.
Save mototeam/e757e1df352a9547839f to your computer and use it in GitHub Desktop.
MotoPress Custom Layouts
<?php
/**
* Plugin Name: MotoPress Custom Layouts
* Plugin URI: http://www.getmotopress.com/
* Description: This example describes how to add custom predefined layouts.
* Version: 1.0
* Author: MotoPress Team
* Author URI: http://www.getmotopress.com/
* License: GPL2 or later
*/
function motopress_custom_layouts($motopressCELibrary) {
$defaultText = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut nibh mi, viverra et nibh nec, aliquet mollis urna. Fusce vehicula malesuada cursus. Nullam in aliquam risus.';
$myCustomLayout1Content = <<<CONTENT
[mp_row]
[mp_span col="4"]
[mp_row_inner]
[mp_span_inner col="12"]
[mp_image size="full" link_type="custom_url" link="#" target="false" align="left"]
[/mp_span_inner]
[/mp_row_inner]
[mp_row_inner]
[mp_span_inner col="12"]
[mp_text]
{$defaultText}
[/mp_text]
[/mp_span_inner]
[/mp_row_inner]
[/mp_span]
[mp_span col="4"]
[mp_row_inner]
[mp_span_inner col="12"]
[mp_image size="full" link_type="custom_url" link="#" target="false" align="left"]
[/mp_span_inner]
[/mp_row_inner]
[mp_row_inner]
[mp_span_inner col="12"]
[mp_text]
{$defaultText}
[/mp_text]
[/mp_span_inner]
[/mp_row_inner]
[/mp_span]
[mp_span col="4"]
[mp_row_inner]
[mp_span_inner col="12"]
[mp_image size="full" link_type="custom_url" link="#" target="false" align="left"]
[/mp_span_inner]
[/mp_row_inner]
[mp_row_inner]
[mp_span_inner col="12"]
[mp_text]
{$defaultText}
[/mp_text]
[/mp_span_inner]
[/mp_row_inner]
[/mp_span]
[/mp_row]
CONTENT;
$myCustomLayout1 = new MPCETemplate(MPCEShortcode::PREFIX . 'custom_layout_1', "My Template 1", $myCustomLayout1Content, '');
$motopressCELibrary->addTemplate(array($myCustomLayout1));
}
add_action('mp_library', 'motopress_custom_layouts', 10, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment