feedback implemented
This commit is contained in:
@@ -1,12 +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'
|
||||
]);
|
||||
}
|
||||
<?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'
|
||||
]);
|
||||
}
|
||||
|
@@ -1,64 +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;
|
||||
}
|
||||
<?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;
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
function themeStarter_adjust_queries($query)
|
||||
{
|
||||
|
||||
// Search Archive Query Adjustment
|
||||
if ($query->is_search()) {
|
||||
$query->set('posts_per_page', '-1');
|
||||
$query->set('order', 'ASC');
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
function themeStarter_adjust_queries($query)
|
||||
{
|
||||
|
||||
// Search Page Query Adjustment
|
||||
if ($query->is_search()) {
|
||||
$query->set('posts_per_page', '-1');
|
||||
$query->set('order', 'ASC');
|
||||
}
|
||||
}
|
||||
|
@@ -1,54 +1,54 @@
|
||||
<?php
|
||||
|
||||
// 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)) {
|
||||
// // Read the content from the file
|
||||
// $file_content = file_get_contents($file_path);
|
||||
|
||||
// // Update the page content
|
||||
// wp_update_post(array(
|
||||
// 'ID' => $page->ID,
|
||||
// 'post_content' => $file_content,
|
||||
// ));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
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,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<?php
|
||||
|
||||
// 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)) {
|
||||
// // Read the content from the file
|
||||
// $file_content = file_get_contents($file_path);
|
||||
|
||||
// // Update the page content
|
||||
// wp_update_post(array(
|
||||
// 'ID' => $page->ID,
|
||||
// 'post_content' => $file_content,
|
||||
// ));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
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,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user