Step 1.1: Theme directory structure with base files

This commit is contained in:
Hanson.xyz Dev
2025-11-28 15:58:18 -06:00
parent 1d9f365644
commit 7b1b91eb66
9 changed files with 729 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
<?php
/**
* HomeProz Theme Functions
*
* @package HomeProz
*/
// Prevent direct access
if (!defined('ABSPATH')) {
exit;
}
// Theme version for cache busting
define('HOMEPROZ_VERSION', '1.0.0');
// Theme directory path and URI
define('HOMEPROZ_DIR', get_template_directory());
define('HOMEPROZ_URI', get_template_directory_uri());
/**
* Include theme files
*/
// Theme setup (supports, menus, etc.)
require_once HOMEPROZ_DIR . '/inc/theme-setup.php';
// Scripts and styles
require_once HOMEPROZ_DIR . '/inc/enqueue.php';
// Template helper functions
require_once HOMEPROZ_DIR . '/inc/template-functions.php';
@@ -0,0 +1,85 @@
<?php
/**
* Enqueue scripts and styles
*
* @package HomeProz
*/
// Prevent direct access
if (!defined('ABSPATH')) {
exit;
}
/**
* Enqueue frontend scripts and styles
*/
function homeproz_scripts() {
// Main stylesheet (Vite compiled)
if (file_exists(HOMEPROZ_DIR . '/dist/assets/main.css')) {
wp_enqueue_style(
'homeproz-style',
HOMEPROZ_URI . '/dist/assets/main.css',
array(),
HOMEPROZ_VERSION
);
}
// jQuery is already included in WordPress, just ensure it's loaded
wp_enqueue_script('jquery');
// Main JavaScript (Vite compiled)
if (file_exists(HOMEPROZ_DIR . '/dist/assets/main.js')) {
wp_enqueue_script(
'homeproz-script',
HOMEPROZ_URI . '/dist/assets/main.js',
array('jquery'),
HOMEPROZ_VERSION,
true
);
// Localize script with useful data
wp_localize_script('homeproz-script', 'homeproz', array(
'ajaxurl' => admin_url('admin-ajax.php'),
'nonce' => wp_create_nonce('homeproz_nonce'),
'siteurl' => get_site_url(),
));
}
// Google Fonts - Abril Fatface and Inter
wp_enqueue_style(
'homeproz-fonts',
'https://fonts.googleapis.com/css2?family=Abril+Fatface&family=Inter:wght@400;500;600;700&display=swap',
array(),
null
);
}
add_action('wp_enqueue_scripts', 'homeproz_scripts');
/**
* Enqueue editor styles
*/
function homeproz_editor_styles() {
add_editor_style('dist/assets/editor.css');
// Google Fonts for editor
add_editor_style('https://fonts.googleapis.com/css2?family=Abril+Fatface&family=Inter:wght@400;500;600;700&display=swap');
}
add_action('after_setup_theme', 'homeproz_editor_styles');
/**
* Add preconnect for Google Fonts
*/
function homeproz_resource_hints($urls, $relation_type) {
if ($relation_type === 'preconnect') {
$urls[] = array(
'href' => 'https://fonts.googleapis.com',
'crossorigin' => 'anonymous',
);
$urls[] = array(
'href' => 'https://fonts.gstatic.com',
'crossorigin' => 'anonymous',
);
}
return $urls;
}
add_filter('wp_resource_hints', 'homeproz_resource_hints', 10, 2);
@@ -0,0 +1,154 @@
<?php
/**
* Template Helper Functions
*
* @package HomeProz
*/
// Prevent direct access
if (!defined('ABSPATH')) {
exit;
}
/**
* Get the page-specific body class
*
* Returns the appropriate class name for the current page/template
* Used for page-scoped CSS and JavaScript
*
* @return string The page class name
*/
function homeproz_get_page_class() {
if (is_front_page()) {
return 'Home_Page';
}
if (is_home()) {
return 'Blog_Archive';
}
if (is_post_type_archive('property')) {
return 'Properties_Archive';
}
if (is_singular('property')) {
return 'Single_Property';
}
if (is_singular('post')) {
return 'Single_Post';
}
if (is_page_template('page-about.php') || is_page('about')) {
return 'About_Page';
}
if (is_page_template('page-contact.php') || is_page('contact')) {
return 'Contact_Page';
}
if (is_search()) {
return 'Search_Page';
}
if (is_404()) {
return 'Error_404';
}
if (is_archive()) {
return 'Archive_Page';
}
if (is_page()) {
return 'Default_Page';
}
return 'Default_Page';
}
/**
* Add page class to body classes
*/
function homeproz_body_classes($classes) {
$classes[] = homeproz_get_page_class();
// Add class if no sidebar
if (!is_active_sidebar('sidebar-blog') || is_front_page() || is_page()) {
$classes[] = 'no-sidebar';
}
return $classes;
}
add_filter('body_class', 'homeproz_body_classes');
/**
* Custom excerpt length
*/
function homeproz_excerpt_length($length) {
return 25;
}
add_filter('excerpt_length', 'homeproz_excerpt_length');
/**
* Custom excerpt more
*/
function homeproz_excerpt_more($more) {
return '&hellip;';
}
add_filter('excerpt_more', 'homeproz_excerpt_more');
/**
* Get property status badge class
*
* @param string $status The property status
* @return string CSS class for the badge
*/
function homeproz_get_status_class($status) {
$status = strtolower($status);
switch ($status) {
case 'active':
return 'badge-success';
case 'pending':
return 'badge-warning';
case 'sold':
return 'badge-muted';
default:
return 'badge-default';
}
}
/**
* Format price for display
*
* @param int|float $price The price value
* @return string Formatted price
*/
function homeproz_format_price($price) {
if (empty($price) || $price <= 0) {
return 'Contact for Price';
}
return '$' . number_format($price);
}
/**
* Get theme option (placeholder for future ACF options)
*
* @param string $key Option key
* @param mixed $default Default value
* @return mixed Option value
*/
function homeproz_get_option($key, $default = '') {
// This will be expanded when ACF is installed
// For now, return defaults
$options = array(
'phone' => '507-516-4870',
'email' => 'info@homeprozrealestate.com',
'address' => '111 E Clark St, Albert Lea, MN 56007',
'facebook' => 'https://www.facebook.com/profile.php?id=61578834743321',
'tiktok' => 'https://www.tiktok.com/@homeproz.real.est',
);
return isset($options[$key]) ? $options[$key] : $default;
}
@@ -0,0 +1,114 @@
<?php
/**
* Theme Setup
*
* @package HomeProz
*/
// Prevent direct access
if (!defined('ABSPATH')) {
exit;
}
/**
* Sets up theme defaults and registers support for various WordPress features.
*/
function homeproz_setup() {
// Add default posts and comments RSS feed links to head
add_theme_support('automatic-feed-links');
// Let WordPress manage the document title
add_theme_support('title-tag');
// Enable support for Post Thumbnails on posts and pages
add_theme_support('post-thumbnails');
// Custom image sizes
add_image_size('property-card', 640, 400, true); // 16:10 ratio for property cards
add_image_size('property-gallery', 1200, 800, true); // Gallery images
add_image_size('agent-photo', 400, 400, true); // Square agent photos
// Register navigation menus
register_nav_menus(array(
'primary' => esc_html__('Primary Menu', 'homeproz'),
'footer' => esc_html__('Footer Menu', 'homeproz'),
));
// Switch default core markup to output valid HTML5
add_theme_support('html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'style',
'script',
));
// Add support for block styles
add_theme_support('wp-block-styles');
// Add support for responsive embeds
add_theme_support('responsive-embeds');
// Add support for editor styles
add_theme_support('editor-styles');
// Add support for custom logo
add_theme_support('custom-logo', array(
'height' => 100,
'width' => 300,
'flex-height' => true,
'flex-width' => true,
));
// Disable core block patterns (we'll add our own)
remove_theme_support('core-block-patterns');
}
add_action('after_setup_theme', 'homeproz_setup');
/**
* Register widget areas
*/
function homeproz_widgets_init() {
register_sidebar(array(
'name' => esc_html__('Blog Sidebar', 'homeproz'),
'id' => 'sidebar-blog',
'description' => esc_html__('Widgets for the blog sidebar.', 'homeproz'),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
));
register_sidebar(array(
'name' => esc_html__('Footer Column 1', 'homeproz'),
'id' => 'footer-1',
'description' => esc_html__('First footer widget area.', 'homeproz'),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title">',
'after_title' => '</h4>',
));
register_sidebar(array(
'name' => esc_html__('Footer Column 2', 'homeproz'),
'id' => 'footer-2',
'description' => esc_html__('Second footer widget area.', 'homeproz'),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title">',
'after_title' => '</h4>',
));
register_sidebar(array(
'name' => esc_html__('Footer Column 3', 'homeproz'),
'id' => 'footer-3',
'description' => esc_html__('Third footer widget area.', 'homeproz'),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widget-title">',
'after_title' => '</h4>',
));
}
add_action('widgets_init', 'homeproz_widgets_init');
+40
View File
@@ -0,0 +1,40 @@
<?php
/**
* Main template file
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
*
* @package HomeProz
*/
get_header();
?>
<main id="primary" class="site-main">
<?php
if (have_posts()) :
while (have_posts()) :
the_post();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title('<h1 class="entry-title">', '</h1>'); ?>
</header>
<div class="entry-content">
<?php the_content(); ?>
</div>
</article>
<?php
endwhile;
else :
?>
<p><?php esc_html_e('No content found.', 'homeproz'); ?></p>
<?php
endif;
?>
</main>
<?php
get_footer();
+17
View File
@@ -0,0 +1,17 @@
/**
* HomeProz Main JavaScript
*
* @package HomeProz
*/
import './main.scss';
(function($) {
'use strict';
// Document ready
$(function() {
console.log('HomeProz theme initialized');
});
})(jQuery);
+268
View File
@@ -0,0 +1,268 @@
/**
* HomeProz Main Styles
*
* @package HomeProz
*/
// Import Tailwind
@import 'tailwind.css';
// ============================================
// CSS Custom Properties (Design Tokens)
// ============================================
:root {
// Colors
--color-bg-dark: #0A0A0A;
--color-bg-card: #161616;
--color-accent: #9F3730;
--color-accent-hover: #C8473F;
--color-accent-light: #BF524B;
--color-text: #F5F5F5;
--color-text-muted: #B0B0B0;
--color-border: #2A2A2A;
--color-success: #2E7D32;
--color-warning: #F9A825;
--color-sold: #757575;
// Typography
--font-display: 'Abril Fatface', Georgia, serif;
--font-body: 'Inter', 'Droid Sans', Arial, sans-serif;
// Spacing
--container-max: 1200px;
--container-padding: 1.5rem;
// Transitions (minimal, only functional)
--transition-fast: 150ms ease;
}
// ============================================
// Base Styles
// ============================================
html {
font-size: 16px;
scroll-behavior: smooth;
}
body {
font-family: var(--font-body);
background-color: var(--color-bg-dark);
color: var(--color-text-muted);
line-height: 1.6;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
// ============================================
// Typography
// ============================================
h1, h2, h3, h4, h5, h6 {
font-family: var(--font-display);
color: var(--color-text);
font-weight: 400;
line-height: 1.2;
margin-bottom: 1rem;
}
h1 { font-size: 3rem; }
h2 { font-size: 2.25rem; }
h3 { font-size: 1.875rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.125rem; }
p {
margin-bottom: 1rem;
}
a {
color: var(--color-accent-light);
text-decoration: none;
&:hover {
color: var(--color-accent-hover);
}
}
// ============================================
// Layout
// ============================================
.container {
max-width: var(--container-max);
margin-left: auto;
margin-right: auto;
padding-left: var(--container-padding);
padding-right: var(--container-padding);
}
.site-main {
min-height: 50vh;
padding: 2rem 0;
}
// ============================================
// Components
// ============================================
// Buttons
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0.75rem 1.5rem;
font-family: var(--font-body);
font-weight: 600;
font-size: 0.875rem;
text-transform: uppercase;
letter-spacing: 0.05em;
border-radius: 0.25rem;
border: none;
cursor: pointer;
&-primary {
background-color: var(--color-accent);
color: white;
&:hover {
background-color: var(--color-accent-hover);
color: white;
}
}
&-secondary {
background-color: transparent;
border: 2px solid var(--color-accent);
color: var(--color-accent);
&:hover {
background-color: var(--color-accent);
color: white;
}
}
}
// Status badges
.badge {
display: inline-block;
padding: 0.25rem 0.75rem;
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
border-radius: 0.25rem;
&-success {
background-color: var(--color-success);
color: white;
}
&-warning {
background-color: var(--color-warning);
color: #000;
}
&-muted {
background-color: var(--color-sold);
color: white;
}
}
// Cards
.card {
background-color: var(--color-bg-card);
border-radius: 0.5rem;
overflow: hidden;
}
// ============================================
// Forms
// ============================================
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="search"],
textarea,
select {
width: 100%;
padding: 0.75rem 1rem;
background-color: var(--color-bg-card);
border: 1px solid var(--color-border);
border-radius: 0.25rem;
color: var(--color-text);
font-family: var(--font-body);
font-size: 1rem;
&::placeholder {
color: var(--color-sold);
}
&:focus {
outline: none;
border-color: var(--color-accent);
}
}
// ============================================
// Utility Classes
// ============================================
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
// ============================================
// WordPress Core Styles
// ============================================
.alignwide {
max-width: calc(var(--container-max) + 200px);
}
.alignfull {
width: 100vw;
position: relative;
left: 50%;
right: 50%;
margin-left: -50vw;
margin-right: -50vw;
}
.wp-block-image img {
max-width: 100%;
height: auto;
}
// ============================================
// Responsive
// ============================================
@media (max-width: 768px) {
:root {
--container-padding: 1rem;
}
h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
}
@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
+18
View File
@@ -0,0 +1,18 @@
/*
Theme Name: HomeProz
Theme URI: https://homeprozrealestate.com
Author: Hanson.xyz
Author URI: https://hanson.xyz
Description: Custom WordPress theme for HomeProz Real Estate. Features property listings with ACF, dark theme with rust accents, and modern responsive design.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.1
License: Proprietary
License URI:
Text Domain: homeproz
Tags: real-estate, dark-mode, custom-colors, custom-logo, featured-images, full-width-template
HomeProz Real Estate Theme
Copyright 2025 Hanson.xyz
*/