current progress

This commit is contained in:
prospect
2023-12-26 22:56:58 -05:00
commit 7843c7b084
99 changed files with 42808 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
<?php
function themeStarter_editor_enqueue()
{
add_theme_support('editor-styles');
add_editor_style([
'assets/css/styles.css',
'assets/css/bootstrap-icons.css',
'assets/css/font-awesome.css'
]);
}

View File

@@ -0,0 +1,64 @@
<?php
// Get List of Sub Categories for Slug
function getSubpagesForSlug($arrayOfWPPages, $slug)
{
foreach ($arrayOfWPPages as $page) {
if ($page['page']->post_name === $slug) {
return $page['subpages'];
}
}
// Return an empty array if the slug is not found
return [];
}
// Return WordPress Page For A Slug
function getPageForSlug($arrayOfWPPages, $slug)
{
foreach ($arrayOfWPPages as $page) {
if ($page['page']->post_name === $slug) {
return $page['page'];
}
foreach ($page['subpages'] as $index => $subpage) {
if ($subpage->post_name === $slug) {
return $page['subpages'][$index];
}
}
}
// Return an empty array if the slug is not found
return [];
}
function ddd($variable)
{
echo '<pre>';
var_dump($variable);
echo '<pre>';
}
// Get An Array of Top Level Pages and their Subpages
function get_pages_as_array()
{
$pages = get_pages();
$page_hierarchy = array();
foreach ($pages as $page) {
$parent_id = $page->post_parent;
// If it's a top-level page
if ($parent_id == 0) {
$page_hierarchy[$page->ID] = array(
'page' => $page,
'subpages' => array()
);
} else {
// If it's a child page, add it under its parent
$page_hierarchy[$parent_id]['subpages'][] = $page;
}
}
return $page_hierarchy;
}