File manager - Edit - /home/proidvn/app.proid.vn/setup-portal-pages.php
Back
<?php require_once('wp-load.php'); $pages = array( 'login' => array( 'title' => 'Login', 'template' => 'page-login.php' ), 'account' => array( 'title' => 'My Account', 'template' => 'page-account.php' ), 'edit-card' => array( 'title' => 'Edit Card', 'template' => 'page-edit-card.php', 'parent' => 'account' ) ); foreach ($pages as $slug => $data) { $existing = get_page_by_path($slug); if (!$existing) { $parent_id = 0; if (isset($data['parent'])) { $parent = get_page_by_path($data['parent']); if ($parent) $parent_id = $parent->ID; } $page_id = wp_insert_post(array( 'post_title' => $data['title'], 'post_name' => $slug, 'post_type' => 'page', 'post_status' => 'publish', 'post_parent' => $parent_id )); if ($page_id) { update_post_meta($page_id, '_wp_page_template', $data['template']); echo "Created page: $slug (ID: $page_id)\n"; } } else { update_post_meta($existing->ID, '_wp_page_template', $data['template']); echo "Updated template for existing page: $slug\n"; } }
| ver. 1.4 |
Github
|
.
| PHP 8.0.30 | Generation time: 0.13 |
proxy
|
phpinfo
|
Settings