layers_create_builder_page

The Layers layers create builder page function.

Description

layers_create_builder_page( (string) $page_title = 'Builder Page', (null) $page_id = null ); 

Parameters (2)

0. $page_title — Optional. (string) => 'Builder Page'
The page title.
1. $page_id — Optional. (null) => null
The page id.

Usage

  1. if ( !function_exists( 'layers_create_builder_page' ) ) { 
  2. require_once '/core/helpers/post.php'; 
  3.  
  4. // The page title. 
  5. $page_title = 'Builder Page'; 
  6.  
  7. // The page id. 
  8. $page_id = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = layers_create_builder_page($page_title, $page_id); 
  12.  

Defined (1)

The function is defined in the following location(s).

/core/helpers/post.php  
  1. function layers_create_builder_page( $page_title = 'Builder Page', $page_id = NULL ) { 
  2.  
  3. $page['post_type'] = 'page'; 
  4. $page['post_status'] = 'publish'; 
  5. $page['post_title'] = $page_title; 
  6.  
  7. if( NULL != $page_id ) { 
  8. $page['ID'] = $page_id; 
  9. $pageid = wp_update_post ($page); 
  10. } else { 
  11. $pageid = wp_insert_post ($page); 
  12. if ( 0 != $pageid ) { 
  13. update_post_meta( $pageid , '_wp_page_template', LAYERS_BUILDER_TEMPLATE ); 
  14.  
  15. return $pageid;