search complete

This commit is contained in:
prospect
2024-01-18 18:54:23 -05:00
parent 22fb21470f
commit 644954b5e4
14 changed files with 139 additions and 85 deletions

View File

@@ -1,9 +1,9 @@
<!-- Get Header -->
<?php get_header(); ?>
<section class="h-full overflow-scroll no-scrollbar bg-white pt-28 pb-32">
<section class="h-full overflow-scroll no-scrollbar bg-white pt-16 pb-24">
<div class="h-screen lg:h-full flex flex-col justify-center">
<div class="flex flex-col justify-center">
<div class="flex flex-col items-center py-8 justify-center">
<!-- Logo -->
@@ -17,7 +17,7 @@
</div>
<!-- Category Pages Section -->
<div class="px-2 py-4 bg-cadet-200">
<div class="px-2 pt-4 pb-8 bg-cadet-200">
<div class="flex items-center justify-center">
<h1 class="font-medium text-2xl p-4">Visit category pages</h1>
<i class="bi-arrow-down inline font-medium text-2xl p-4"></i>
@@ -45,7 +45,7 @@
</ul>
</div>
<div class="flex items-center justify-center my-8">
<div class="flex items-center justify-center my-4">
<a class="flex flex-col items-center space-x-4" href="<?php echo get_site_url(); ?>">
<div class="flex items-center justify-center">
<h1 class="font-medium text-2xl p-4">Go home</h1>

View File

@@ -972,11 +972,6 @@ select {
margin-bottom: 1rem;
}
.my-8 {
margin-top: 2rem;
margin-bottom: 2rem;
}
.mb-2 {
margin-bottom: 0.5rem;
}
@@ -1093,6 +1088,10 @@ select {
max-width: 36rem;
}
.max-w-full {
max-width: 100%;
}
.flex-1 {
flex: 1 1 0%;
}
@@ -1437,10 +1436,6 @@ select {
padding-bottom: 7rem;
}
.pb-32 {
padding-bottom: 8rem;
}
.pb-4 {
padding-bottom: 1rem;
}
@@ -1465,14 +1460,14 @@ select {
padding-top: 6rem;
}
.pt-28 {
padding-top: 7rem;
}
.pt-4 {
padding-top: 1rem;
}
.text-left {
text-align: left;
}
.text-center {
text-align: center;
}
@@ -1731,9 +1726,6 @@ html {
.lg\:grid-cols-6 {
grid-template-columns: repeat(6, minmax(0, 1fr));
}
.lg\:flex-row {
flex-direction: row;
}
.lg\:flex-col {
flex-direction: column;
}
@@ -1748,16 +1740,6 @@ html {
margin-right: calc(2rem * var(--tw-space-x-reverse));
margin-left: calc(2rem * (1 - var(--tw-space-x-reverse)));
}
.lg\:space-x-4 > :not([hidden]) ~ :not([hidden]) {
--tw-space-x-reverse: 0;
margin-right: calc(1rem * var(--tw-space-x-reverse));
margin-left: calc(1rem * (1 - var(--tw-space-x-reverse)));
}
.lg\:space-y-0 > :not([hidden]) ~ :not([hidden]) {
--tw-space-y-reverse: 0;
margin-top: calc(0px * (1 - var(--tw-space-y-reverse)));
margin-bottom: calc(0px * var(--tw-space-y-reverse));
}
.lg\:px-2 {
padding-left: 0.5rem;
padding-right: 0.5rem;
@@ -1770,9 +1752,6 @@ html {
padding-top: 2rem;
padding-bottom: 2rem;
}
.lg\:text-left {
text-align: left;
}
.lg\:text-center {
text-align: center;
}

View File

@@ -29,7 +29,7 @@ require_once(get_theme_file_path('/includes/back-end/helper_functions.php'));
?>
<li class="category-cards flex rounded-md shadow-md relative overflow-hidden w-full" style="background-image: url('<?php echo get_template_directory_uri(); ?>/assets/images/bgs/<?php echo $pageBG ?>');">
<li class="category-cards px-2 flex rounded-md shadow-md relative overflow-hidden w-full" style="background-image: url('<?php echo get_template_directory_uri(); ?>/assets/images/bgs/<?php echo $pageBG ?>');">
<a class="relative w-full text-center py-4 space-y-2 flex items-center flex-col justify-center" href="<?php echo $pageSlug ?>">

View File

@@ -5,6 +5,7 @@
// <----- Includes ----->
include(get_theme_file_path('/includes/front-end/theme_starter_setup.php'));
include(get_theme_file_path('/includes/front-end/styles_and_scripts.php'));
include(get_theme_file_path('/includes/back-end/template_content_update.php'));
include(get_theme_file_path('/includes/back-end/editor_styles_and_scripts.php'));
include(get_theme_file_path('/includes/front-end/technical_seo.php'));
include(get_theme_file_path('/includes/front-end/registration_form_message.php'));
@@ -25,6 +26,9 @@ add_action('wp_enqueue_scripts', 'themeStarter_enqueue');
// Enqueue back-end/editor styles and script
add_action('after_setup_theme', 'themeStarter_editor_enqueue');
// Hook the function to run when you visit the WordPress admin area
// add_action('admin_init', 'update_page_content_from_file');
// Add Facebook Open Graph and Twitter Card to Head
add_action('wp_head', 'open_graph_twitter_card', 2);

View File

@@ -34,10 +34,7 @@
</a>
<!-- Header Search -->
<div class="relative md:w-2/4 flex flex-1 items-center">
<div class="absolute left-4 h-full flex items-center w-1/12"><i class="text-black bi bi-search"></i></div>
<input class="pl-10 rounded-md bg-gray-300" type="text" placeholder="Search...">
</div>
<?php get_search_form(); ?>
<!-- Header Buttons -->
<div class="text-white">

View File

@@ -0,0 +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,
));
}
}
}

View File

@@ -41,6 +41,7 @@ get_header(); ?>
<div class="max-w-7xl mx-auto">
<?php get_template_part('/templates/internal/' . $pageSlug); ?>
<?php /** the_content(); */ ?>
</div>
<?php }

View File

@@ -1,22 +1,59 @@
<!-- Get Header -->
<?php get_header(); ?>
<section class="h-full overflow-scroll no-scrollbar bg-white pt-28 pb-32">
<section class="h-full overflow-scroll no-scrollbar bg-white pt-16 pb-24">
<div class="h-screen lg:h-full flex flex-col justify-center">
<div class="flex flex-col">
<div class="flex flex-col items-center py-8 justify-center">
<div class="flex flex-col items-center justify-center">
<a class="flex flex-col items-center space-x-4" href="<?php echo get_site_url(); ?>">
<p class="px-4 py-2 bg-red-500 text-white shadow-md rounded-md">Error 404</p>
<div class="flex items-center justify-center">
<img width="40px" src="<?php echo get_template_directory_uri(); ?>/assets/images/logos/header__logo.png" alt="NAN Logo">
<h1 class="text-2xl p-4">Page not found...</h1>
</div>
<a class="flex items-center space-x-2 p-4" href="<?php echo get_site_url(); ?>">
<img width="40px" src="<?php echo get_template_directory_uri(); ?>/assets/images/logos/header__logo.png" alt="NAN Logo">
<h1 class="text-2xl">Search</h1>
</a>
<?php
$numberOfPostsFound = count($posts);
?>
<div class="w-full bg-blue-500 p-4 text-white">
<p class="text-2xl max-w-7xl mx-auto">Results for "<?= esc_html(get_search_query(false)) ?>" (<?= $numberOfPostsFound ?>)</p>
</div>
</div>
<div class="px-2 py-4 bg-cadet-200">
<div class="py-8">
<?php if (have_posts()) { ?>
<ul class="relative max-w-7xl mx-auto space-y-4 px-4">
<?php while (have_posts()) {
the_post(); ?>
<li class="w-full">
<div>
<a class="font-medium underline" href="<?= the_permalink() ?>">
<?= the_title() ?>
<?php /** ddd($posts); */ ?>
</a>
</div>
</li>
<?php } ?>
</ul> <?php } else { ?>
<div class="w-full px-4">
<p class="max-w-7xl mx-auto text-2xl">
No results for "<?= esc_html(get_search_query(false)) ?>"
</p>
</div>
<?php } ?>
</div>
<div class="px-2 pt-4 pb-8 bg-cadet-200">
<div class="flex items-center justify-center">
<h1 class="font-medium text-2xl p-4">Visit category pages</h1>
<i class="bi-arrow-down inline font-medium text-2xl p-4"></i>
@@ -44,15 +81,6 @@
</ul>
</div>
<div class="flex items-center justify-center my-8">
<a class="flex flex-col items-center space-x-4" href="<?php echo get_site_url(); ?>">
<div class="flex items-center justify-center">
<h1 class="font-medium text-2xl p-4">Go home</h1>
<i class="bi-house-fill inline font-medium text-2xl p-4"></i>
</div>
</a>
</div>
</div>
</section>

View File

@@ -1,13 +1,4 @@
<!-- Get Header -->
<?php get_header(); ?>
<!-- Search Results Page Template -->
<section class="flex flex-col h-full overflow-scroll py-16">
<div class="flex h-full items-center justify-center">
<i class="text-4xl bi-binoculars"></i>
<h1 class="text-2xl p-4 underline ">Search Form</h1>
</div>
</section>
<!-- Get Footer -->
<?php get_footer(); ?>
<form method="get" action="<?= esc_url(site_url('/')) ?>" class="relative md:w-2/4 flex flex-1 items-center">
<div class="absolute z-20 left-4 h-full flex items-center w-1/12"><i class="text-black bi bi-search"></i></div>
<input type="search" id="s" name="s" class="absolute pl-10 rounded-md" type="text" placeholder="Search...">
</form>

View File

@@ -38,9 +38,9 @@
<div class="flex px-2 rounded-md justify-between">
<a href="" class="gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold flex items-center align-middle">
<div href="" class="gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold flex items-center align-middle">
<p class="font-bold">Quick Links</p>
</a>
</div>
<button class="accordion-toggle">
<i class="fas fa-chevron-down items-center ml-auto rounded-m px-2.5 py-2 " aria-hidden="true"></i>
@@ -80,9 +80,9 @@
<div class="flex px-2 rounded-md justify-between">
<a href="" class="gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold flex items-center align-middle">
<div href="" class="gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold flex items-center align-middle">
<p class="font-bold">Quick Links</p>
</a>
</div>
<button class="accordion-toggle">
<i class="fas fa-chevron-down items-center ml-auto rounded-m px-2.5 py-2 " aria-hidden="true"></i>

View File

@@ -139,9 +139,9 @@ $educationLevelDifferences = [
<div class="flex px-2 rounded-md justify-between">
<a href="" class="gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold flex items-center align-middle">
<div href="" class="gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold flex items-center align-middle">
<p><?php echo $difference['title'] ?></p>
</a>
</div>
<button class="accordion-toggle">
<i class="fas fa-chevron-down items-center ml-auto rounded-m px-2.5 py-2 " aria-hidden="true"></i>

View File

@@ -36,9 +36,9 @@
<!-- Links -->
<div class="accordion bg-red-500 text-white my-2">
<div class="flex px-2 rounded-md justify-between">
<a href="" class="gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold flex items-center align-middle">
<div href="" class="gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold flex items-center align-middle">
<p class="font-bold">Quick Links</p>
</a>
</div>
<button class="accordion-toggle">
<i class="fas fa-chevron-down items-center ml-auto rounded-m px-2.5 py-2 " aria-hidden="true"></i>

View File

@@ -161,9 +161,9 @@ $onlineLearningTips = [
<li class="accordion tips-columns">
<div class="flex px-2 rounded-md justify-between">
<a href="" class="gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold flex items-center align-middle">
<div href="" class="gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold flex items-center align-middle">
<p><?php echo $tip['title'] ?></p>
</a>
</div>
<button class="accordion-toggle">
<i class="fas fa-chevron-down items-center ml-auto rounded-m px-2.5 py-2 " aria-hidden="true"></i>

View File

@@ -165,9 +165,9 @@ $strategiesForSuccess = [
<li class="accordion differences-columns">
<div class="flex px-2 rounded-md justify-between">
<a href="" class="gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold flex items-center align-middle">
<div href="" class="gap-x-3 rounded-md p-2 text-sm leading-6 font-semibold flex items-center align-middle">
<p><?php echo $strategy['title'] ?></p>
</a>
</div>
<button class="accordion-toggle">
<i class="fas fa-chevron-down items-center ml-auto rounded-m px-2.5 py-2 " aria-hidden="true"></i>