Esempio n. 1
0
 /**
  * Reads predefined content template config from /lib/content_layout/predefined folder
  * Renders HTML output of that template and returns it
  * @author Zvonko Biškup <*****@*****.**>
  * @return string
  */
 public function getPredefinedTemplate()
 {
     if (!empty($_POST['template'])) {
         require_once OP_LIB . 'content_layouts/predefined/' . $_POST['template'] . '.php';
         $this->init_page();
         define('OP_AJAX_SHORTCODE', true);
         require_once OP_ASSETS . 'live_editor.php';
         $html = op_page_generate_layout($config['layouts']);
         echo json_encode(array('output' => $html));
     } else {
         echo json_encode(array('output' => 'error'));
     }
     exit;
 }
Esempio n. 2
0
 /**
  * Saving OP layout to post_content so it can be searched.
  *
  * @param $pageId
  * @param $content
  */
 function saveLayoutToPostContent($pageId, $content)
 {
     $newPost = array('ID' => $pageId, 'post_content' => '<!-- OP_SEARCH_GENERATED -->' . op_page_generate_layout($content));
     wp_update_post($newPost);
 }