diff --git a/functions.php b/functions.php index 9626862..c0ecf23 100644 --- a/functions.php +++ b/functions.php @@ -24,38 +24,33 @@ if ( ! defined( 'ZEITFRESSER_IMAGE_OPTIMIZATION_VERSION' ) ) { /** * ------------------------------------------------------------------------ - * Core Modules + * Customizer * ------------------------------------------------------------------------ */ - -// Helpers (foundation) -require get_template_directory() . '/inc/helpers/zeitfresser-helpers.php'; - -// Theme logic -require get_template_directory() . '/inc/zeitfresser-toc.php'; - -// Performance layer -require get_template_directory() . '/inc/performance/performance-tools.php'; +require get_template_directory() . '/inc/customizer/core-settings.php'; +require get_template_directory() . '/inc/customizer/general-settings.php'; +require get_template_directory() . '/inc/customizer/layout-settings.php'; +require get_template_directory() . '/inc/customizer/toc-settings.php'; +require get_template_directory() . '/inc/customizer/social-settings.php'; +require get_template_directory() . '/inc/customizer/image-optimizer-settings.php'; /** * ------------------------------------------------------------------------ - * Customizer (modular) + * Utilities * ------------------------------------------------------------------------ */ -require get_template_directory() . '/inc/customizer/core.php'; -require get_template_directory() . '/inc/customizer/general.php'; -require get_template_directory() . '/inc/customizer/layout.php'; -require get_template_directory() . '/inc/customizer/toc.php'; -require get_template_directory() . '/inc/customizer/social.php'; +require get_template_directory() . '/inc/utilities/helpers.php'; +require get_template_directory() . '/inc/utilities/template-tags.php'; +require get_template_directory() . '/inc/utilities/template-functions.php'; +require get_template_directory() . '/inc/utilities/pagination.php'; +require get_template_directory() . '/inc/utilities/toc.php'; /** * ------------------------------------------------------------------------ - * Theme Utilities + * Tools * ------------------------------------------------------------------------ */ -require get_template_directory() . '/inc/template-tags.php'; -require get_template_directory() . '/inc/template-functions.php'; -require get_template_directory() . '/inc/pagination.php'; +require get_template_directory() . '/inc/tools/image-optimizer.php'; /** * ------------------------------------------------------------------------ diff --git a/inc/customizer/core-settings.php b/inc/customizer/core-settings.php new file mode 100644 index 0000000..ea87431 --- /dev/null +++ b/inc/customizer/core-settings.php @@ -0,0 +1,58 @@ +get_setting( 'blogname' )->transport = 'postMessage'; + $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; + $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; + + if ( isset( $wp_customize->selective_refresh ) ) { + $wp_customize->selective_refresh->add_partial( + 'blogname', + array( + 'selector' => '.site-title a', + 'render_callback' => 'zeitfresser_customize_partial_blogname', + ) + ); + + $wp_customize->selective_refresh->add_partial( + 'blogdescription', + array( + 'selector' => '.site-description', + 'render_callback' => 'zeitfresser_customize_partial_blogdescription', + ) + ); + } +} +add_action( 'customize_register', 'zeitfresser_customize_register' ); + +/** + * Partial refresh helpers + */ +function zeitfresser_customize_partial_blogname() { + bloginfo( 'name' ); +} + +function zeitfresser_customize_partial_blogdescription() { + bloginfo( 'description' ); +} + +/** + * Live preview JS + */ +function zeitfresser_customize_preview_js() { + wp_enqueue_script( + 'zeitfresser-customizer', + get_template_directory_uri() . '/js/customizer.js', + array( 'customize-preview' ), + ZEITFRESSER_VERSION, + true + ); +} +add_action( 'customize_preview_init', 'zeitfresser_customize_preview_js' ); diff --git a/inc/customizer/general.php b/inc/customizer/general-settings.php similarity index 100% rename from inc/customizer/general.php rename to inc/customizer/general-settings.php diff --git a/inc/customizer/core.php b/inc/customizer/image-optimizer-settings.php similarity index 65% rename from inc/customizer/core.php rename to inc/customizer/image-optimizer-settings.php index 87b3c3e..b5a22f4 100644 --- a/inc/customizer/core.php +++ b/inc/customizer/image-optimizer-settings.php @@ -1,42 +1,24 @@ get_setting( 'blogname' )->transport = 'postMessage'; - $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; - $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; - - if ( isset( $wp_customize->selective_refresh ) ) { - $wp_customize->selective_refresh->add_partial( - 'blogname', - array( - 'selector' => '.site-title a', - 'render_callback' => 'zeitfresser_customize_partial_blogname', - ) - ); - - $wp_customize->selective_refresh->add_partial( - 'blogdescription', - array( - 'selector' => '.site-description', - 'render_callback' => 'zeitfresser_customize_partial_blogdescription', - ) - ); - } +/** + * ------------------------------------------------------------------------ + * Settings + * ------------------------------------------------------------------------ + */ +function zeitfresser_customize_image_optimizer_settings( $wp_customize ) { /** - * Performance Tools Section + * Image Optimizer Section */ $wp_customize->add_section( - 'ztfr_performance_tools', + 'ztfr_image_optimizer', array( - 'title' => 'Performance Tools Settings', + 'title' => 'Image Optimizer', 'priority' => 160, ) ); @@ -56,7 +38,7 @@ function zeitfresser_customize_register( $wp_customize ) { 'ztfr_auto_optimize', array( 'type' => 'checkbox', - 'section' => 'ztfr_performance_tools', + 'section' => 'ztfr_image_optimizer', 'label' => 'Auto Optimize Pictures on Upload', 'description' => 'Automatically converts images to AVIF/WebP.', ) @@ -77,43 +59,21 @@ function zeitfresser_customize_register( $wp_customize ) { 'ztfr_auto_delete', array( 'type' => 'checkbox', - 'section' => 'ztfr_performance_tools', + 'section' => 'ztfr_image_optimizer', 'label' => 'Auto Delete Original Pictures', 'description' => 'Deletes originals after optimization.', ) ); } -add_action( 'customize_register', 'zeitfresser_customize_register' ); +add_action( 'customize_register', 'zeitfresser_customize_image_optimizer_settings' ); + /** - * Partial refresh helpers + * ------------------------------------------------------------------------ + * UI Logic (JS) + * ------------------------------------------------------------------------ */ -function zeitfresser_customize_partial_blogname() { - bloginfo( 'name' ); -} - -function zeitfresser_customize_partial_blogdescription() { - bloginfo( 'description' ); -} - -/** - * Live preview JS - */ -function zeitfresser_customize_preview_js() { - wp_enqueue_script( - 'zeitfresser-customizer', - get_template_directory_uri() . '/js/customizer.js', - array( 'customize-preview' ), - ZEITFRESSER_VERSION, - true - ); -} -add_action( 'customize_preview_init', 'zeitfresser_customize_preview_js' ); - -/** - * Dependency UI logic - */ -function zeitfresser_customize_controls_dependency_js() { +function zeitfresser_customize_image_optimizer_ui() { ?> - + -
@@ -532,7 +532,7 @@ function zeitfresser_render_performance_tools_page() {
• Once optimized, original images can be deleted to save disk space.
Automation:
- • You can enable automatic optimization on upload in the Customizer under Performance Tools Settings.
+ • You can enable automatic optimization on upload in the Customizer under Image Optimizer Settings.
• Optionally, original images can also be deleted automatically after successful optimization.
Safety:
@@ -653,7 +653,7 @@ function deleteBatch() {
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
action: 'zeitfresser_delete_originals',
- nonce: ''
+ nonce: ''
})
})
.then(res => res.json())
@@ -732,7 +732,7 @@ function processBatch() {
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
action: 'zeitfresser_optimize_images',
- nonce: ''
+ nonce: ''
})
})
.then(res => res.json())
diff --git a/inc/helpers/zeitfresser-helpers.php b/inc/utilities/helpers.php
similarity index 100%
rename from inc/helpers/zeitfresser-helpers.php
rename to inc/utilities/helpers.php
diff --git a/inc/pagination.php b/inc/utilities/pagination.php
similarity index 100%
rename from inc/pagination.php
rename to inc/utilities/pagination.php
diff --git a/inc/template-functions.php b/inc/utilities/template-functions.php
similarity index 100%
rename from inc/template-functions.php
rename to inc/utilities/template-functions.php
diff --git a/inc/template-tags.php b/inc/utilities/template-tags.php
similarity index 100%
rename from inc/template-tags.php
rename to inc/utilities/template-tags.php
diff --git a/inc/zeitfresser-toc.php b/inc/utilities/toc.php
similarity index 100%
rename from inc/zeitfresser-toc.php
rename to inc/utilities/toc.php
diff --git a/style.css b/style.css
index 7461b68..d440da9 100644
--- a/style.css
+++ b/style.css
@@ -247,6 +247,16 @@ textarea {
margin: 0;
}
+/* Article Justifiy */
+
+.entry-content p,
+.post-content p {
+ text-align: justify;
+ hyphens: auto;
+ word-break: normal;
+ overflow-wrap: break-word;
+}
+
/* Header Wrapper */
.header-wrapper {
@@ -997,7 +1007,7 @@ header.site-header .social-links svg:hover {
}
.site-header .search-field::placeholder {
- color: var(--light-color) !important;
+ color: var(--dark-color)) !important;
font-weight: 300;
}
@@ -1275,33 +1285,6 @@ header.site-header .social-links svg:hover {
}
}
-/* Search Widget */
-
-.site-header .search-field:focus {
- width: 320px;
-
- background-color: rgba(255,255,255,0.85);
- background-image: url(images/search-b.svg);
-
- cursor: text;
- outline: none;
-}
-
-@media (max-width: 500px) {
- .site-header .search-field:focus {
- width: 100%;
- }
-}
-
-.site-header .search-field::placeholder {
- color: var(--dark-color);
- font-weight: 300;
-}
-
-.site-header .search-submit {
- display: none;
-}
-
/* Sidebar Search */
.widget_search form {
@@ -1366,12 +1349,6 @@ header.site-header .social-links svg:hover {
margin-bottom: var(--space-md);
}
-.entry-content,
-.post-content,
-.inner-article-content {
- max-width: 100%;
-}
-
.single-post .entry-content > * + * {
margin-top: var(--space-md);
}
@@ -1582,7 +1559,6 @@ header.page-header h1 {
display: flex;
align-items: center;
gap: 0.3rem;
-
font-family: var(--primary-font);
margin: 0.5rem 0;
}
@@ -1590,7 +1566,7 @@ header.page-header h1 {
.comments a {
background: none;
color: inherit;
- transform: translateY(-1px);
+ transform: translateY(-0.5px);
}
.comments svg {