first theme commit

This commit is contained in:
2024-05-03 01:55:19 -04:00
commit 3d9ef61176
153 changed files with 53926 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
<?php
/**
* Update wordpress content on admin init.
*
* @package ThemeStarter
*/
function update_page_content_from_file()
{
// Get all pages
$pages = get_pages();
foreach ($pages as $page) {
$slug = $page->post_name;
$file_path = get_template_directory() . '/templates/internal/' . $slug . '.php';
// Check if the file exists
if (file_exists($file_path)) {
// Start output buffering to capture PHP output
ob_start();
// Include the file to execute its PHP code
include($file_path);
// Get the output and clean the output buffer
$file_content = ob_get_clean();
// Update the page content
wp_update_post(array(
'ID' => $page->ID,
'post_content' => $file_content,
));
}
}
}