refactor(core): introduce modular architecture and restructure theme into clean, maintainable components
This commit introduces a complete internal refactoring of the theme architecture, transitioning from a monolithic functions.php structure to a modular, scalable system. ### Key Changes #### 1. Modular Architecture - Extracted core logic into dedicated modules under `/inc/` - Introduced clear separation of concerns: - `helpers/` → shared utility functions - `performance/` → optimization and media processing logic - `customizer/` → fully modularized Customizer structure - `template-*` → presentation and template-related logic #### 2. Customizer Refactor - Replaced legacy monolithic customizer with modular system: - `core.php` → base setup - `general.php`, `layout.php`, `toc.php`, `social.php` → feature-based modules - Improved maintainability and extensibility for future settings #### 3. Performance Layer Separation - Moved performance-related logic into `/inc/performance/` - Clearly separated: - frontend performance tweaks (scripts, CSS, cleanup) - media optimization tools (batch processing, cleanup UI) - Reduced coupling between UI, logic, and processing #### 4. Media Optimization Pipeline Stabilization - Re-aligned upload pipeline with WordPress native flow - Restored proper use of `wp_generate_attachment_metadata` - Ensured compatibility with: - format conversion (AVIF/WebP) - responsive image generation - WordPress core image handling #### 5. Cleaner Hook Management - Removed duplicated hooks and redundant filters - Standardized hook priorities and responsibilities - Ensured consistent use of feature toggles (`get_theme_mod`) #### 6. Improved Code Quality - Reduced function duplication - Standardized naming conventions - Improved readability and inline documentation - Removed legacy patterns and implicit dependencies #### 7. Asset Handling Improvements - Introduced centralized asset versioning via `filemtime` - Improved script loading strategy (defer non-critical JS) - Cleaner enqueue structure for styles and scripts #### 8. Foundation for Future Development This refactor lays the groundwork for: - easier feature expansion - better testability - improved debugging capabilities - long-term maintainability ### Breaking Changes - Internal file structure has changed significantly - Direct modifications to old functions.php logic may no longer apply - Customizer extensions must now hook into modular structure --- This is a purely structural and architectural release. No intentional changes to frontend behavior were introduced, but the internal system is now significantly more robust and maintainable.
This commit is contained in:
@@ -2,137 +2,36 @@
|
||||
/**
|
||||
* Template part for displaying results in search pages
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
$show_hide_image = get_theme_mod( 'post_snippet_hide_show_featured_image', zeitfresser_get_default_post_snippet_featured_image() );
|
||||
$show_hide_date = get_theme_mod( 'post_snippet_hide_show_date', zeitfresser_get_default_post_snippet_date() );
|
||||
$show_hide_author = get_theme_mod( 'post_snippet_hide_show_author', zeitfresser_get_default_post_snippet_author() );
|
||||
$show_hide_comment = get_theme_mod( 'post_snippet_hide_show_comment', zeitfresser_get_default_post_snippet_comment() );
|
||||
$show_hide_categories = get_theme_mod( 'post_snippet_hide_show_category', zeitfresser_get_default_post_snippet_category() );
|
||||
$show_hide_tags = get_theme_mod( 'post_snippet_hide_show_tag', zeitfresser_get_default_post_snippet_tag() );
|
||||
$show_hide_social_share = get_theme_mod( 'post_snippet_hide_show_social_share', zeitfresser_get_default_post_snippet_social_share() );
|
||||
$social_share = get_theme_mod( 'post_snippet_social_share_options', zeitfresser_get_default_post_snippet_social_share_options() );
|
||||
?>
|
||||
|
||||
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||
<div class="news-snippet">
|
||||
<?php if ( $show_hide_image && has_post_thumbnail() ) : ?>
|
||||
<?php $thumbnail_size = get_theme_mod( 'post_snippet_featured_image_size', zeitfresser_get_default_post_snippet_featured_image_size() ); ?>
|
||||
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark" class="featured-image">
|
||||
<?php the_post_thumbnail( $thumbnail_size ); ?>
|
||||
</a>
|
||||
|
||||
<?php if ( zeitfresser_show_post_card_featured_image() && has_post_thumbnail() ) : ?>
|
||||
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark" class="featured-image">
|
||||
<?php the_post_thumbnail( zeitfresser_get_post_card_thumbnail_size() ); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="summary">
|
||||
<?php if( $show_hide_categories ) { ?>
|
||||
|
||||
<?php $categories = get_the_category();
|
||||
if( ! empty( $categories ) ) : ?>
|
||||
<div class="category">
|
||||
<?php foreach ( $categories as $category ) { ?>
|
||||
<a
|
||||
href="<?php echo esc_url( get_category_link( $category->term_id ) ); ?>"><?php echo esc_html( $category->name ); ?></a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<h3 class="news-title"><a href="<?php echo esc_url( get_permalink() ); ?>"
|
||||
rel="bookmark"><?php the_title(); ?></a></h3>
|
||||
|
||||
<div class="ihead info">
|
||||
<ul class="list-inline">
|
||||
<?php if( $show_hide_date ) { ?>
|
||||
|
||||
<?php $archive_year = get_the_time('Y'); $archive_month = get_the_time('m'); $archive_day = get_the_time('d'); ?>
|
||||
<li><a
|
||||
href="<?php echo esc_url( get_day_link( $archive_year, $archive_month, $archive_day ) ); ?>"><?php echo get_the_date(); ?></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
if( $show_hide_author ) { ?>
|
||||
<li class="post-author">
|
||||
<a class="url fn n"
|
||||
href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>">
|
||||
<?php $avatar = get_avatar( get_the_author_meta( 'ID' ), $size = 60 ); ?>
|
||||
<?php if( $avatar ) : ?>
|
||||
<div class="author-image">
|
||||
<?php echo esc_url($avatar); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php echo esc_html( get_the_author() ); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
|
||||
<?php if( $show_hide_comment ) { ?>
|
||||
<span class="comments">
|
||||
<svg width="20px" height="20px" viewBox="0 0 24 24" id="magicoon-Regular"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="comment-Regular">
|
||||
<path id="comment-Regular-2" data-name="comment-Regular" class="cls-1"
|
||||
d="M17,3.25H7A4.756,4.756,0,0,0,2.25,8V21a.75.75,0,0,0,1.28.53l2.414-2.414a1.246,1.246,0,0,1,.885-.366H17A4.756,4.756,0,0,0,21.75,14V8A4.756,4.756,0,0,0,17,3.25ZM20.25,14A3.254,3.254,0,0,1,17,17.25H6.829a2.73,2.73,0,0,0-1.945.806L3.75,19.189V8A3.254,3.254,0,0,1,7,4.75H17A3.254,3.254,0,0,1,20.25,8Z" />
|
||||
</g>
|
||||
</svg>
|
||||
<?php comments_popup_link( __( '0', 'zeitfresser' ), __( '1', 'zeitfresser' ), __( '%', 'zeitfresser' ) ); ?>
|
||||
</span>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<h3 class="news-title">
|
||||
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark">
|
||||
<?php the_title(); ?>
|
||||
</a>
|
||||
</h3>
|
||||
|
||||
<div class="excerpt">
|
||||
<?php $excerpt_length = get_theme_mod( 'post_snippet_excerpt_size', zeitfresser_get_default_post_snippet_excerpt_size() ); ?>
|
||||
|
||||
<?php echo wp_trim_words( get_the_excerpt(), $excerpt_length ); ?>
|
||||
<?php echo esc_html(
|
||||
wp_trim_words(
|
||||
get_the_excerpt(),
|
||||
zeitfresser_get_post_card_excerpt_length()
|
||||
)
|
||||
); ?>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php $readmore_show_hide = get_theme_mod( 'post_snippet_hide_show_readmore', zeitfresser_get_default_post_snippet_show_hide_read_more() ); ?>
|
||||
<?php $readmore_text = get_theme_mod( 'post_snippet_readmore_text', zeitfresser_get_default_post_snippet_read_more_text() ); ?>
|
||||
|
||||
|
||||
<div class="ifoot info">
|
||||
|
||||
<?php if( $readmore_show_hide ) { ?>
|
||||
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark" title=""
|
||||
class="readmore"><?php echo esc_html( $readmore_text ); ?></a>
|
||||
<?php } ?>
|
||||
|
||||
<?php if( $show_hide_social_share && $social_share ) { ?>
|
||||
<div class="social-share">
|
||||
<?php get_template_part( 'inc/blocks/includes/template', 'social-share', $social_share ); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php if( $show_hide_tags ) { ?>
|
||||
<div class="tags">
|
||||
<?php $tags = get_the_tags(); ?>
|
||||
<?php if( ! empty( $tags ) ) : ?>
|
||||
<?php foreach ( $tags as $post_tag ) { ?>
|
||||
<a
|
||||
href="<?php echo esc_url( get_category_link( $post_tag->term_id ) ); ?>"><?php echo esc_html( $post_tag->name ); ?></a>
|
||||
<?php } ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,21 +4,9 @@
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
$show_hide_image = get_theme_mod( 'post_detail_hide_show_featured_image', zeitfresser_get_default_post_detail_featured_image() );
|
||||
$show_hide_date = get_theme_mod( 'post_detail_hide_show_date', zeitfresser_get_default_post_detail_date() );
|
||||
$show_hide_author = get_theme_mod( 'post_detail_hide_show_author', zeitfresser_get_default_post_detail_author() );
|
||||
$show_hide_comment = get_theme_mod( 'post_detail_hide_show_comment', zeitfresser_get_default_post_detail_comment() );
|
||||
$show_hide_categories = get_theme_mod( 'post_detail_hide_show_category', zeitfresser_get_default_post_detail_category() );
|
||||
$show_hide_tags = get_theme_mod( 'post_detail_hide_show_tag', zeitfresser_get_default_post_detail_tag() );
|
||||
$show_hide_author_block = get_theme_mod( 'post_detail_hide_show_author_block', zeitfresser_get_default_post_detail_author_block() );
|
||||
$show_hide_social_share = get_theme_mod( 'post_detail_hide_show_social_share', zeitfresser_get_default_post_detail_social_share() );
|
||||
$social_share = get_theme_mod( 'post_detail_social_share_options', zeitfresser_get_default_post_detail_social_share_options() );
|
||||
$toc_payload = zeitfresser_build_toc_payload( get_the_ID() );
|
||||
$has_floating_toc = ! empty( $toc_payload['items'] );
|
||||
$toc_payload = zeitfresser_build_toc_payload( get_the_ID() );
|
||||
$has_floating_toc = ! empty( $toc_payload['items'] );
|
||||
?>
|
||||
|
||||
<div class="zeitfresser-article-heading">
|
||||
@@ -29,161 +17,61 @@
|
||||
<?php zeitfresser_render_floating_toc( get_the_ID() ); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<div class="single-post">
|
||||
|
||||
|
||||
|
||||
<div class="post-content">
|
||||
|
||||
<!-- Meta Info -->
|
||||
<div class="ihead info">
|
||||
<ul class="list-inline">
|
||||
<?php
|
||||
if( $show_hide_date ) { ?>
|
||||
|
||||
<?php $archive_year = get_the_time('Y'); $archive_month = get_the_time('m'); $archive_day = get_the_time('d'); ?>
|
||||
<li class="post-date"><i class="icon-calendar"></i> <a
|
||||
href="<?php echo esc_url( get_day_link( $archive_year, $archive_month, $archive_day ) ); ?>"><?php echo get_the_date(); ?></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
if( $show_hide_author ) { ?>
|
||||
<li class="post-author"><i class="icon-user"></i>
|
||||
<a class="url fn n"
|
||||
href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>">
|
||||
<?php $avatar = get_avatar( get_the_author_meta( 'ID' ), $size = 60 ); ?>
|
||||
<?php if( $avatar ) : ?>
|
||||
<div class="author-image">
|
||||
<?php echo esc_url($avatar); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php echo esc_html( get_the_author() ); ?>
|
||||
<!-- Date (TRUE) -->
|
||||
<?php
|
||||
$archive_year = get_the_time('Y');
|
||||
$archive_month = get_the_time('m');
|
||||
$archive_day = get_the_time('d');
|
||||
?>
|
||||
<li class="post-date">
|
||||
<i class="icon-calendar"></i>
|
||||
<a href="<?php echo esc_url( get_day_link( $archive_year, $archive_month, $archive_day ) ); ?>">
|
||||
<?php echo esc_html( get_the_date() ); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<?php if( $show_hide_comment ) { ?>
|
||||
<!-- Comments (TRUE) -->
|
||||
<span class="comments">
|
||||
<svg width="20px" height="20px" viewBox="0 0 24 24" id="magicoon-Regular"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="comment-Regular">
|
||||
<path id="comment-Regular-2" data-name="comment-Regular" class="cls-1"
|
||||
d="M17,3.25H7A4.756,4.756,0,0,0,2.25,8V21a.75.75,0,0,0,1.28.53l2.414-2.414a1.246,1.246,0,0,1,.885-.366H17A4.756,4.756,0,0,0,21.75,14V8A4.756,4.756,0,0,0,17,3.25ZM20.25,14A3.254,3.254,0,0,1,17,17.25H6.829a2.73,2.73,0,0,0-1.945.806L3.75,19.189V8A3.254,3.254,0,0,1,7,4.75H17A3.254,3.254,0,0,1,20.25,8Z" />
|
||||
<svg width="20px" height="20px" viewBox="0 0 24 24">
|
||||
<g>
|
||||
<path d="M17,3.25H7A4.756,4.756,0,0,0,2.25,8V21a.75.75,0,0,0,1.28.53l2.414-2.414a1.246,1.246,0,0,1,.885-.366H17A4.756,4.756,0,0,0,21.75,14V8A4.756,4.756,0,0,0,17,3.25Z"/>
|
||||
</g>
|
||||
</svg>
|
||||
<?php comments_popup_link( __( '0', 'zeitfresser' ), __( '1', 'zeitfresser' ), __( '%', 'zeitfresser' ) ); ?>
|
||||
</span>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Featured Image (FALSE → entfernt) -->
|
||||
|
||||
<?php if( $show_hide_categories ) { ?>
|
||||
|
||||
<?php $categories = get_the_category();
|
||||
if( ! empty( $categories ) ) : ?>
|
||||
<div class="category">
|
||||
<?php foreach ( $categories as $category ) { ?>
|
||||
<a
|
||||
href="<?php echo esc_url( get_category_link( $category->term_id ) ); ?>"><?php echo esc_html( $category->name ); ?></a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
$page_template = get_page_template_slug( get_queried_object_id() );
|
||||
if($page_template != 'single-thumbnail.php'){
|
||||
?>
|
||||
|
||||
<?php if ( $show_hide_image && has_post_thumbnail() ) : ?>
|
||||
<?php $thumbnail_size = get_theme_mod( 'post_detail_featured_image_size', zeitfresser_get_default_post_detail_featured_image_size() ); ?>
|
||||
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark" class="featured-image">
|
||||
<?php the_post_thumbnail( $thumbnail_size ); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php } ?>
|
||||
|
||||
<!-- Article Content -->
|
||||
<article>
|
||||
|
||||
<div class="inner-article-content">
|
||||
<?php echo $toc_payload['content']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<?php echo $toc_payload['content']; // phpcs:ignore ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
wp_link_pages( array(
|
||||
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'zeitfresser' ),
|
||||
'after' => '</div>',
|
||||
) );
|
||||
?>
|
||||
wp_link_pages( array(
|
||||
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'zeitfresser' ),
|
||||
'after' => '</div>',
|
||||
) );
|
||||
?>
|
||||
</article>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Author Block (FALSE → entfernt) -->
|
||||
<!-- Categories (FALSE → entfernt) -->
|
||||
<!-- Tags (FALSE → entfernt) -->
|
||||
<!-- Social Share (FALSE → entfernt) -->
|
||||
|
||||
|
||||
|
||||
<div class="ifoot info">
|
||||
|
||||
|
||||
|
||||
<?php if( $show_hide_social_share && $social_share ) { ?>
|
||||
<div class="social-share">
|
||||
<?php get_template_part( 'inc/blocks/includes/template', 'social-share', $social_share ); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
<?php if( $show_hide_tags ) { ?>
|
||||
|
||||
<div class="tags">
|
||||
<?php $tags = get_the_tags();
|
||||
if( ! empty( $tags ) ) : ?>
|
||||
|
||||
<?php foreach ( $tags as $post_tag ) { ?>
|
||||
<a
|
||||
href="<?php echo esc_url( get_category_link( $post_tag->term_id ) ); ?>"><?php echo esc_html( $post_tag->name ); ?></a>
|
||||
<?php }
|
||||
|
||||
endif; ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php if( $show_hide_author_block ) : ?>
|
||||
<div class="author-post clearfix">
|
||||
<?php $avatar = get_avatar( get_the_author_meta( 'ID' ), $size = 75 ); ?>
|
||||
<?php if( $avatar ) : ?>
|
||||
<div class="author-image">
|
||||
<a
|
||||
href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>"><?php echo $avatar; ?></a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="author-details">
|
||||
<h4><a
|
||||
href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>"><?php echo esc_html( get_the_author() ); ?></a>
|
||||
</h4>
|
||||
<p><?php echo esc_html( get_the_author_meta('description') ); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+20
-118
@@ -6,133 +6,35 @@
|
||||
*/
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
$show_hide_image = get_theme_mod( 'post_snippet_hide_show_featured_image', zeitfresser_get_default_post_snippet_featured_image() );
|
||||
$show_hide_date = get_theme_mod( 'post_snippet_hide_show_date', zeitfresser_get_default_post_snippet_date() );
|
||||
$show_hide_author = get_theme_mod( 'post_snippet_hide_show_author', zeitfresser_get_default_post_snippet_author() );
|
||||
$show_hide_comment = get_theme_mod( 'post_snippet_hide_show_comment', zeitfresser_get_default_post_snippet_comment() );
|
||||
$show_hide_categories = get_theme_mod( 'post_snippet_hide_show_category', zeitfresser_get_default_post_snippet_category() );
|
||||
$show_hide_tags = get_theme_mod( 'post_snippet_hide_show_tag', zeitfresser_get_default_post_snippet_tag() );
|
||||
$show_hide_social_share = get_theme_mod( 'post_snippet_hide_show_social_share', zeitfresser_get_default_post_snippet_social_share() );
|
||||
$social_share = get_theme_mod( 'post_snippet_social_share_options', zeitfresser_get_default_post_snippet_social_share_options() );
|
||||
?>
|
||||
|
||||
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||
|
||||
<div class="news-snippet">
|
||||
<?php if ( $show_hide_image && has_post_thumbnail() ) : ?>
|
||||
<?php $thumbnail_size = get_theme_mod( 'post_snippet_featured_image_size', zeitfresser_get_default_post_snippet_featured_image_size() ); ?>
|
||||
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark" class="featured-image">
|
||||
<?php
|
||||
$size = ! empty( $thumbnail_size ) ? $thumbnail_size : 'zeitfresser-card';
|
||||
the_post_thumbnail( $size );
|
||||
?>
|
||||
</a>
|
||||
|
||||
<?php if ( zeitfresser_show_post_card_featured_image() && has_post_thumbnail() ) : ?>
|
||||
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark" class="featured-image">
|
||||
<?php the_post_thumbnail( zeitfresser_get_post_card_thumbnail_size() ); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="summary">
|
||||
<?php if( $show_hide_categories ) { ?>
|
||||
|
||||
<?php $categories = get_the_category();
|
||||
if( ! empty( $categories ) ) : ?>
|
||||
<div class="category">
|
||||
<?php foreach ( $categories as $category ) { ?>
|
||||
<a
|
||||
href="<?php echo esc_url( get_category_link( $category->term_id ) ); ?>"><?php echo esc_html( $category->name ); ?></a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<h3 class="news-title"><a href="<?php echo esc_url( get_permalink() ); ?>"
|
||||
rel="bookmark"><?php the_title(); ?></a></h3>
|
||||
|
||||
<div class="ihead info">
|
||||
<ul class="list-inline">
|
||||
<?php if( $show_hide_date ) { ?>
|
||||
|
||||
<?php $archive_year = get_the_time('Y'); $archive_month = get_the_time('m'); $archive_day = get_the_time('d'); ?>
|
||||
<li><a
|
||||
href="<?php echo esc_url( get_day_link( $archive_year, $archive_month, $archive_day ) ); ?>"><?php echo get_the_date(); ?></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
if( $show_hide_author ) { ?>
|
||||
<li class="post-author">
|
||||
<a class="url fn n"
|
||||
href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>">
|
||||
<?php $avatar = get_avatar( get_the_author_meta( 'ID' ), $size = 60 ); ?>
|
||||
<?php if( $avatar ) : ?>
|
||||
<div class="author-image">
|
||||
<?php echo esc_url($avatar); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php echo esc_html( get_the_author() ); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
|
||||
<?php if( $show_hide_comment ) { ?>
|
||||
<span class="comments">
|
||||
<svg width="20px" height="20px" viewBox="0 0 24 24" id="magicoon-Regular"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="comment-Regular">
|
||||
<path id="comment-Regular-2" data-name="comment-Regular" class="cls-1"
|
||||
d="M17,3.25H7A4.756,4.756,0,0,0,2.25,8V21a.75.75,0,0,0,1.28.53l2.414-2.414a1.246,1.246,0,0,1,.885-.366H17A4.756,4.756,0,0,0,21.75,14V8A4.756,4.756,0,0,0,17,3.25ZM20.25,14A3.254,3.254,0,0,1,17,17.25H6.829a2.73,2.73,0,0,0-1.945.806L3.75,19.189V8A3.254,3.254,0,0,1,7,4.75H17A3.254,3.254,0,0,1,20.25,8Z" />
|
||||
</g>
|
||||
</svg>
|
||||
<?php comments_popup_link( __( '0', 'zeitfresser' ), __( '1', 'zeitfresser' ), __( '%', 'zeitfresser' ) ); ?>
|
||||
</span>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<h3 class="news-title">
|
||||
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark">
|
||||
<?php the_title(); ?>
|
||||
</a>
|
||||
</h3>
|
||||
|
||||
<div class="excerpt">
|
||||
<?php $excerpt_length = get_theme_mod( 'post_snippet_excerpt_size', zeitfresser_get_default_post_snippet_excerpt_size() ); ?>
|
||||
|
||||
<?php echo wp_trim_words( get_the_excerpt(), $excerpt_length ); ?>
|
||||
<?php echo esc_html(
|
||||
wp_trim_words(
|
||||
get_the_excerpt(),
|
||||
zeitfresser_get_post_card_excerpt_length()
|
||||
)
|
||||
); ?>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php $readmore_show_hide = get_theme_mod( 'post_snippet_hide_show_readmore', zeitfresser_get_default_post_snippet_show_hide_read_more() ); ?>
|
||||
<?php $readmore_text = get_theme_mod( 'post_snippet_readmore_text', zeitfresser_get_default_post_snippet_read_more_text() ); ?>
|
||||
|
||||
|
||||
<div class="ifoot info">
|
||||
|
||||
<?php if( $readmore_show_hide ) { ?>
|
||||
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark" title=""
|
||||
class="readmore"><?php echo esc_html( $readmore_text ); ?></a>
|
||||
<?php } ?>
|
||||
|
||||
<?php if( $show_hide_social_share && $social_share ) { ?>
|
||||
<div class="social-share">
|
||||
<?php get_template_part( 'inc/blocks/includes/template', 'social-share', $social_share ); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php if( $show_hide_tags ) { ?>
|
||||
<div class="tags">
|
||||
<?php $tags = get_the_tags(); ?>
|
||||
<?php if( ! empty( $tags ) ) : ?>
|
||||
<?php foreach ( $tags as $post_tag ) { ?>
|
||||
<a
|
||||
href="<?php echo esc_url( get_category_link( $post_tag->term_id ) ); ?>"><?php echo esc_html( $post_tag->name ); ?></a>
|
||||
<?php } ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -3,13 +3,6 @@ $page_template = get_page_template_slug( get_queried_object_id() );
|
||||
$post_count = 3;
|
||||
?>
|
||||
|
||||
<?php
|
||||
$readmore_show_hide = get_theme_mod( 'post_snippet_hide_show_readmore', zeitfresser_get_default_post_snippet_show_hide_read_more() );
|
||||
$readmore_text = get_theme_mod( 'post_snippet_readmore_text', zeitfresser_get_default_post_snippet_read_more_text() );
|
||||
|
||||
$related_articles_title = get_theme_mod( 'post_detail_related_articles_title', zeitfresser_get_default_post_detail_related_articles_title() );
|
||||
?>
|
||||
|
||||
<div class="related-posts">
|
||||
<?php
|
||||
$args = array(
|
||||
@@ -23,53 +16,44 @@ $post_count = 3;
|
||||
'update_post_term_cache' => false,
|
||||
);
|
||||
|
||||
|
||||
$query = new WP_Query( $args );
|
||||
if( $query->have_posts() ) {
|
||||
?>
|
||||
<h2 class="main-title"><?php echo esc_html( $related_articles_title ); ?></h2>
|
||||
<div class="post-holder">
|
||||
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
|
||||
<div class="news-snippet">
|
||||
|
||||
<?php if( get_theme_mod( 'post_snippet_hide_show_featured_image', zeitfresser_get_default_post_snippet_featured_image() ) && has_post_thumbnail() ) : ?>
|
||||
if ( $query->have_posts() ) :
|
||||
?>
|
||||
<h2 class="main-title">Related Posts</h2>
|
||||
|
||||
<?php $thumbnail_size = get_theme_mod( 'post_snippet_featured_image_size', zeitfresser_get_default_post_snippet_featured_image_size() ); ?>
|
||||
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark" class="featured-image">
|
||||
<?php the_post_thumbnail( $thumbnail_size ); ?>
|
||||
</a>
|
||||
<div class="post-holder">
|
||||
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
|
||||
<div class="news-snippet">
|
||||
|
||||
<?php endif; ?>
|
||||
<?php if ( zeitfresser_show_post_card_featured_image() && has_post_thumbnail() ) : ?>
|
||||
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark" class="featured-image">
|
||||
<?php the_post_thumbnail( zeitfresser_get_post_card_thumbnail_size() ); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="summary">
|
||||
<h5 class="news-title">
|
||||
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark">
|
||||
<?php the_title(); ?>
|
||||
</a>
|
||||
</h5>
|
||||
<div class="summary">
|
||||
|
||||
<div class="excerpt">
|
||||
<?php $excerpt_length = get_theme_mod( 'post_snippet_excerpt_size', zeitfresser_get_default_post_snippet_excerpt_size() ); ?>
|
||||
<h5 class="news-title">
|
||||
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark">
|
||||
<?php the_title(); ?>
|
||||
</a>
|
||||
</h5>
|
||||
|
||||
<?php echo wp_trim_words( get_the_excerpt(), $excerpt_length ); ?>
|
||||
</div>
|
||||
<div class="excerpt">
|
||||
<?php echo esc_html(
|
||||
wp_trim_words(
|
||||
get_the_excerpt(),
|
||||
zeitfresser_get_post_card_excerpt_length()
|
||||
)
|
||||
); ?>
|
||||
</div>
|
||||
|
||||
<?php if( $readmore_show_hide ) { ?>
|
||||
<div class="ifoot info">
|
||||
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark" title=""
|
||||
class="readmore"><?php echo esc_html( $readmore_text ); ?> </a>
|
||||
<?php if( get_theme_mod( 'post_snippet_hide_show_social_share', zeitfresser_get_default_post_snippet_social_share() ) ) { ?>
|
||||
<div class="social-share">
|
||||
<?php get_template_part( 'inc/blocks/includes/template', 'social-share' ); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<?php endwhile; ?>
|
||||
<?php wp_reset_postdata(); ?>
|
||||
</div>
|
||||
<?php endwhile; ?>
|
||||
<?php wp_reset_postdata(); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user