introduce
This commit is contained in:
|
Before Width: | Height: | Size: 264 B After Width: | Height: | Size: 264 B |
|
Before Width: | Height: | Size: 264 B After Width: | Height: | Size: 264 B |
+4
-1
@@ -5,7 +5,10 @@
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
$copyright = get_theme_mod( 'footer_copyright_text', zeitfresser_get_default_footer_copyright() );
|
||||
$copyright = get_theme_mod(
|
||||
'footer_copyright_text',
|
||||
'© ' . date('Y') . ' Zeitfresser'
|
||||
);
|
||||
?>
|
||||
|
||||
<footer id="colophon" class="site-footer">
|
||||
|
||||
+325
-419
@@ -4,34 +4,63 @@
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Theme Constants
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
if ( ! defined( 'ZEITFRESSER_VERSION' ) ) {
|
||||
define( 'ZEITFRESSER_VERSION', '2.3.6' );
|
||||
}
|
||||
|
||||
if ( ! defined( 'DAISY_BLOG_VERSION' ) ) {
|
||||
define( 'DAISY_BLOG_VERSION', ZEITFRESSER_VERSION );
|
||||
}
|
||||
|
||||
if ( ! defined( 'ZEITFRESSER_IMAGE_OPTIMIZATION_VERSION' ) ) {
|
||||
define( 'ZEITFRESSER_IMAGE_OPTIMIZATION_VERSION', '1.0' );
|
||||
}
|
||||
|
||||
require get_template_directory() . '/inc/zeitfresser-helpers.php';
|
||||
require get_template_directory() . '/inc/performance-tools.php';
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Core Modules
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
// Helpers (foundation)
|
||||
require get_template_directory() . '/inc/helpers/zeitfresser-helpers.php';
|
||||
|
||||
// Theme logic
|
||||
require get_template_directory() . '/inc/zeitfresser-toc.php';
|
||||
|
||||
/**
|
||||
* Upload Handler
|
||||
*/
|
||||
add_filter('wp_handle_upload', 'zeitfresser_capture_original_upload', 10, 2);
|
||||
// Performance layer
|
||||
require get_template_directory() . '/inc/performance/performance-tools.php';
|
||||
|
||||
/**
|
||||
* Capture original upload path safely
|
||||
* ------------------------------------------------------------------------
|
||||
* Customizer (modular)
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
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';
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Theme Utilities
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
require get_template_directory() . '/inc/template-tags.php';
|
||||
require get_template_directory() . '/inc/template-functions.php';
|
||||
require get_template_directory() . '/inc/pagination.php';
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Upload Handling (Original File Tracking)
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
function zeitfresser_capture_original_upload( $upload, $context ) {
|
||||
|
||||
@@ -80,69 +109,64 @@ function zeitfresser_store_original_file( $attachment_id ) {
|
||||
add_action( 'add_attachment', 'zeitfresser_store_original_file' );
|
||||
|
||||
/**
|
||||
* Theme setup.
|
||||
*
|
||||
* @return void
|
||||
* ------------------------------------------------------------------------
|
||||
* Theme Setup
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
function zeitfresser_setup() {
|
||||
|
||||
load_theme_textdomain( 'zeitfresser', get_template_directory() . '/languages' );
|
||||
|
||||
add_theme_support( 'automatic-feed-links' );
|
||||
add_theme_support( 'title-tag' );
|
||||
add_theme_support( 'post-thumbnails' );
|
||||
add_theme_support(
|
||||
'html5',
|
||||
array(
|
||||
'search-form',
|
||||
'comment-form',
|
||||
'comment-list',
|
||||
'gallery',
|
||||
'caption',
|
||||
'style',
|
||||
'script',
|
||||
)
|
||||
);
|
||||
|
||||
add_theme_support( 'html5', array(
|
||||
'search-form',
|
||||
'comment-form',
|
||||
'comment-list',
|
||||
'gallery',
|
||||
'caption',
|
||||
'style',
|
||||
'script',
|
||||
));
|
||||
|
||||
add_theme_support( 'customize-selective-refresh-widgets' );
|
||||
add_theme_support(
|
||||
'custom-logo',
|
||||
array(
|
||||
'height' => 250,
|
||||
'width' => 250,
|
||||
'flex-width' => true,
|
||||
'flex-height' => true,
|
||||
)
|
||||
);
|
||||
|
||||
add_theme_support( 'custom-logo', array(
|
||||
'height' => 250,
|
||||
'width' => 250,
|
||||
'flex-width' => true,
|
||||
'flex-height' => true,
|
||||
));
|
||||
|
||||
add_theme_support( 'align-wide' );
|
||||
add_theme_support( 'wp-block-styles' );
|
||||
add_theme_support( 'responsive-embeds' );
|
||||
|
||||
register_nav_menus(
|
||||
array(
|
||||
'menu-1' => esc_html__( 'Primary', 'zeitfresser' ),
|
||||
)
|
||||
);
|
||||
register_nav_menus( array(
|
||||
'menu-1' => esc_html__( 'Primary', 'zeitfresser' ),
|
||||
));
|
||||
|
||||
add_editor_style( 'editor-style.css' );
|
||||
}
|
||||
add_action( 'after_setup_theme', 'zeitfresser_setup' );
|
||||
|
||||
/**
|
||||
* Register optimized image sizes
|
||||
* ------------------------------------------------------------------------
|
||||
* Image Sizes
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
function zeitfresser_custom_image_sizes() {
|
||||
|
||||
// Content images (main article)
|
||||
add_image_size( 'zeitfresser-content', 720, 0, false );
|
||||
|
||||
// Archive / card layout
|
||||
add_image_size( 'zeitfresser-card', 480, 0, false );
|
||||
}
|
||||
add_action( 'after_setup_theme', 'zeitfresser_custom_image_sizes' );
|
||||
|
||||
/**
|
||||
* Set the content width in pixels.
|
||||
*
|
||||
* @return void
|
||||
* ------------------------------------------------------------------------
|
||||
* Content Width
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
function zeitfresser_content_width() {
|
||||
$GLOBALS['content_width'] = apply_filters( 'zeitfresser_content_width', 640 );
|
||||
@@ -150,206 +174,243 @@ function zeitfresser_content_width() {
|
||||
add_action( 'after_setup_theme', 'zeitfresser_content_width', 0 );
|
||||
|
||||
/**
|
||||
* Register widget area.
|
||||
*
|
||||
* @return void
|
||||
* ------------------------------------------------------------------------
|
||||
* Widgets
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
function zeitfresser_widgets_init() {
|
||||
register_sidebar(
|
||||
array(
|
||||
'name' => esc_html__( 'Sidebar', 'zeitfresser' ),
|
||||
'id' => 'sidebar-1',
|
||||
'description' => esc_html__( 'Add widgets here.', 'zeitfresser' ),
|
||||
'before_widget' => '<section id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</section>',
|
||||
'before_title' => '<h4 class="widget-title">',
|
||||
'after_title' => '</h4>',
|
||||
)
|
||||
);
|
||||
register_sidebar( array(
|
||||
'name' => esc_html__( 'Sidebar', 'zeitfresser' ),
|
||||
'id' => 'sidebar-1',
|
||||
'description' => esc_html__( 'Add widgets here.', 'zeitfresser' ),
|
||||
'before_widget' => '<section id="%1$s" class="widget %2$s">',
|
||||
'after_widget' => '</section>',
|
||||
'before_title' => '<h4 class="widget-title">',
|
||||
'after_title' => '</h4>',
|
||||
));
|
||||
}
|
||||
add_action( 'widgets_init', 'zeitfresser_widgets_init' );
|
||||
|
||||
/**
|
||||
* Enqueue floating TOC assets on single posts.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_enqueue_toc_assets() {
|
||||
if ( is_singular( 'post' ) && zeitfresser_has_floating_toc() ) {
|
||||
wp_enqueue_script(
|
||||
'zeitfresser-toc',
|
||||
get_template_directory_uri() . '/js/toc.js',
|
||||
array(),
|
||||
ZEITFRESSER_VERSION,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_enqueue_toc_assets', 20 );
|
||||
|
||||
|
||||
/**
|
||||
* Return file version using filemtime in production-safe form.
|
||||
*
|
||||
* @param string $relative_path Relative file path inside the theme.
|
||||
* @return string
|
||||
*/
|
||||
function zeitfresser_asset_version( $relative_path ) {
|
||||
$path = get_template_directory() . $relative_path;
|
||||
return file_exists( $path ) ? (string) filemtime( $path ) : ZEITFRESSER_VERSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueue scripts and styles.
|
||||
*
|
||||
* @return void
|
||||
* ------------------------------------------------------------------------
|
||||
* Assets
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
function zeitfresser_scripts() {
|
||||
|
||||
// Base stylesheet (theme root)
|
||||
wp_enqueue_style(
|
||||
'zeitfresser',
|
||||
get_template_directory_uri() . '/style.css',
|
||||
array(),
|
||||
zeitfresser_asset_version( '/style.css' )
|
||||
[],
|
||||
file_exists( get_template_directory() . '/style.css' )
|
||||
? filemtime( get_template_directory() . '/style.css' )
|
||||
: ZEITFRESSER_VERSION
|
||||
);
|
||||
|
||||
// Styles
|
||||
$fonts = zeitfresser_asset_versioned('/css/fonts.css');
|
||||
$colors = zeitfresser_asset_versioned('/css/colors.css');
|
||||
|
||||
wp_enqueue_style(
|
||||
'zeitfresser-fonts',
|
||||
$fonts['url'],
|
||||
[],
|
||||
$fonts['version']
|
||||
);
|
||||
|
||||
wp_enqueue_style(
|
||||
'zeitfresser-colors',
|
||||
$colors['url'],
|
||||
['zeitfresser'],
|
||||
$colors['version']
|
||||
);
|
||||
|
||||
// Scripts
|
||||
$nav = zeitfresser_asset_versioned('/js/navigation.js');
|
||||
$scripts = zeitfresser_asset_versioned('/js/scripts.js');
|
||||
|
||||
wp_enqueue_script(
|
||||
'zeitfresser-navigation',
|
||||
get_template_directory_uri() . '/js/navigation.js',
|
||||
array(),
|
||||
zeitfresser_asset_version( '/js/navigation.js' ),
|
||||
$nav['url'],
|
||||
[],
|
||||
$nav['version'],
|
||||
true
|
||||
);
|
||||
|
||||
if ( is_home() || is_front_page() || is_archive() || is_search() ) {
|
||||
wp_enqueue_script(
|
||||
'zeitfresser-masonry',
|
||||
get_template_directory_uri() . '/js/masonry.pkgd.min.js',
|
||||
array(),
|
||||
zeitfresser_asset_version( '/js/masonry.pkgd.min.js' ),
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
wp_enqueue_script(
|
||||
'zeitfresser-scripts',
|
||||
get_template_directory_uri() . '/js/scripts.js',
|
||||
array(),
|
||||
zeitfresser_asset_version( '/js/scripts.js' ),
|
||||
$scripts['url'],
|
||||
[],
|
||||
$scripts['version'],
|
||||
true
|
||||
);
|
||||
|
||||
// WordPress native threaded comments
|
||||
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
|
||||
wp_enqueue_script( 'comment-reply' );
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_scripts', 10 );
|
||||
|
||||
|
||||
/**
|
||||
* Load RTL stylesheet from /css folder
|
||||
* ------------------------------------------------------------------------
|
||||
* Performance Tweaks
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
function zeitfresser_rtl_styles() {
|
||||
if ( is_rtl() ) {
|
||||
wp_enqueue_style(
|
||||
'zeitfresser-rtl',
|
||||
get_template_directory_uri() . '/css/style-rtl.css',
|
||||
array('zeitfresser'),
|
||||
filemtime(get_template_directory() . '/css/style-rtl.css')
|
||||
);
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Defer non-critical JavaScript
|
||||
* ------------------------------------------------------------------------
|
||||
*
|
||||
* Prevents JS from blocking page rendering.
|
||||
*/
|
||||
function zeitfresser_defer_scripts( $tag, $handle, $src ) {
|
||||
|
||||
$defer_scripts = array(
|
||||
'zeitfresser-navigation',
|
||||
'zeitfresser-scripts',
|
||||
);
|
||||
|
||||
if ( in_array( $handle, $defer_scripts, true ) ) {
|
||||
return str_replace( ' src=', ' defer src=', $tag );
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_rtl_styles', 11 );
|
||||
|
||||
function zeitfresser_enqueue_static_colors() {
|
||||
wp_enqueue_style(
|
||||
'zeitfresser-colors',
|
||||
get_template_directory_uri() . '/css/colors.css',
|
||||
array('zeitfresser'),
|
||||
file_exists(get_template_directory() . '/css/colors.css')
|
||||
? filemtime(get_template_directory() . '/css/colors.css')
|
||||
: ZEITFRESSER_VERSION
|
||||
);
|
||||
return $tag;
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_enqueue_static_colors', 20 );
|
||||
|
||||
function zeitfresser_enqueue_static_fonts() {
|
||||
wp_enqueue_style(
|
||||
'zeitfresser-fonts',
|
||||
get_template_directory_uri() . '/css/fonts.css',
|
||||
array(),
|
||||
file_exists(get_template_directory() . '/css/fonts.css')
|
||||
? filemtime(get_template_directory() . '/css/fonts.css')
|
||||
: ZEITFRESSER_VERSION
|
||||
);
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_enqueue_static_fonts', 15 );
|
||||
|
||||
add_filter( 'script_loader_tag', 'zeitfresser_defer_scripts', 10, 3 );
|
||||
|
||||
/**
|
||||
* Theme package marker kept for compatibility with the original premium controls.
|
||||
* ------------------------------------------------------------------------
|
||||
* Image Loading Optimization (LCP + Lazy Loading)
|
||||
* ------------------------------------------------------------------------
|
||||
*
|
||||
* @return string
|
||||
* Ensures the first visible image loads immediately (LCP),
|
||||
* while all other images are lazy-loaded for performance.
|
||||
*/
|
||||
function zeitfresser_free_pro() {
|
||||
return 'pro';
|
||||
}
|
||||
function zeitfresser_optimize_image_attributes( $attr, $attachment, $size ) {
|
||||
|
||||
require get_template_directory() . '/inc/template-tags.php';
|
||||
require get_template_directory() . '/inc/template-functions.php';
|
||||
require get_template_directory() . '/inc/customizer.php';
|
||||
static $is_first = true;
|
||||
|
||||
if ( defined( 'JETPACK__VERSION' ) ) {
|
||||
require get_template_directory() . '/inc/jetpack.php';
|
||||
}
|
||||
|
||||
require get_template_directory() . '/inc/blocks/blocks.php';
|
||||
require get_template_directory() . '/inc/pagination.php';
|
||||
|
||||
/**
|
||||
* Add safe front-end performance optimizations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_performance_setup() {
|
||||
// Disable the legacy embeds script on the front end. Native iframes still work.
|
||||
if ( ! is_admin() ) {
|
||||
wp_deregister_script( 'wp-embed' );
|
||||
|
||||
if ( $is_first ) {
|
||||
// First image (critical for LCP)
|
||||
$attr['loading'] = 'eager';
|
||||
$is_first = false;
|
||||
} else {
|
||||
// All other images
|
||||
$attr['loading'] = 'lazy';
|
||||
}
|
||||
|
||||
// Improve decoding performance
|
||||
$attr['decoding'] = 'async';
|
||||
}
|
||||
|
||||
return $attr;
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_performance_setup', 100 );
|
||||
add_filter( 'wp_get_attachment_image_attributes', 'zeitfresser_optimize_image_attributes', 10, 3 );
|
||||
|
||||
/**
|
||||
* Remove unnecessary head output for a leaner front end.
|
||||
* Lower the threshold for WordPress scaled originals when auto optimization is enabled.
|
||||
*
|
||||
* @return void
|
||||
* When automatic optimization is disabled, original uploads should remain untouched.
|
||||
*
|
||||
* @return int|false
|
||||
*/
|
||||
function zeitfresser_cleanup_wp_head() {
|
||||
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
|
||||
remove_action( 'wp_print_styles', 'print_emoji_styles' );
|
||||
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
|
||||
remove_action( 'admin_print_styles', 'print_emoji_styles' );
|
||||
remove_action( 'wp_head', 'rsd_link' );
|
||||
remove_action( 'wp_head', 'wlwmanifest_link' );
|
||||
remove_action( 'wp_head', 'wp_generator' );
|
||||
remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
|
||||
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10 );
|
||||
remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 );
|
||||
remove_action( 'wp_head', 'wp_oembed_add_host_js' );
|
||||
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10 );
|
||||
function zeitfresser_big_image_size_threshold() {
|
||||
|
||||
$auto_enabled = get_theme_mod( 'ztfr_auto_optimize', true );
|
||||
$force_enabled = ! empty( $GLOBALS['zeitfresser_force_image_optimization'] );
|
||||
|
||||
if ( ! $auto_enabled && ! $force_enabled ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return 1800;
|
||||
}
|
||||
add_action( 'init', 'zeitfresser_cleanup_wp_head' );
|
||||
add_filter( 'big_image_size_threshold', 'zeitfresser_big_image_size_threshold' );
|
||||
|
||||
/**
|
||||
* Preload critical local fonts only
|
||||
* Skip generating oversized core intermediate sizes we do not use.
|
||||
*
|
||||
* @param array $sizes Registered intermediate sizes.
|
||||
* @return array
|
||||
*/
|
||||
function zeitfresser_filter_intermediate_image_sizes( $sizes ) {
|
||||
|
||||
$auto_enabled = get_theme_mod( 'ztfr_auto_optimize', true );
|
||||
$force_enabled = ! empty( $GLOBALS['zeitfresser_force_image_optimization'] );
|
||||
|
||||
if ( ! $auto_enabled && ! $force_enabled ) {
|
||||
return $sizes;
|
||||
}
|
||||
|
||||
unset(
|
||||
$sizes['1536x1536'],
|
||||
$sizes['2048x2048']
|
||||
);
|
||||
|
||||
return $sizes;
|
||||
}
|
||||
add_filter( 'intermediate_image_sizes_advanced', 'zeitfresser_filter_intermediate_image_sizes' );
|
||||
|
||||
/**
|
||||
* Improve attachment image attributes for layout stability and fetch priority.
|
||||
*
|
||||
* @param array $attr Image markup attributes.
|
||||
* @param WP_Post $attachment Attachment post object.
|
||||
* @param string|array $size Requested image size.
|
||||
* @return array
|
||||
*/
|
||||
function zeitfresser_improve_attachment_dimensions( $attr, $attachment, $size ) {
|
||||
|
||||
if ( empty( $attr['width'] ) || empty( $attr['height'] ) ) {
|
||||
$metadata = wp_get_attachment_metadata( $attachment->ID );
|
||||
|
||||
if ( is_array( $metadata ) && ! empty( $metadata['width'] ) && ! empty( $metadata['height'] ) ) {
|
||||
if ( empty( $attr['width'] ) ) {
|
||||
$attr['width'] = (int) $metadata['width'];
|
||||
}
|
||||
|
||||
if ( empty( $attr['height'] ) ) {
|
||||
$attr['height'] = (int) $metadata['height'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $attr['fetchpriority'] ) && ! is_admin() && ! is_feed() ) {
|
||||
static $did_set_high_priority = false;
|
||||
|
||||
if ( ! $did_set_high_priority && is_singular() ) {
|
||||
$attr['fetchpriority'] = 'high';
|
||||
$did_set_high_priority = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $attr;
|
||||
}
|
||||
add_filter( 'wp_get_attachment_image_attributes', 'zeitfresser_improve_attachment_dimensions', 11, 3 );
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Preload critical fonts
|
||||
* ------------------------------------------------------------------------
|
||||
*
|
||||
* Preloads only the fonts that are needed for initial rendering
|
||||
* (headings + body text). This improves LCP and avoids render delays.
|
||||
*/
|
||||
function zeitfresser_preload_fonts() {
|
||||
?>
|
||||
<!-- Critical Fonts Only -->
|
||||
<link rel="preload" href="<?php echo get_template_directory_uri(); ?>/fonts/oswald-400.woff2" as="font" type="font/woff2" crossorigin>
|
||||
<link rel="preload" href="<?php echo get_template_directory_uri(); ?>/fonts/oswald-700.woff2" as="font" type="font/woff2" crossorigin>
|
||||
<link rel="preload" href="<?php echo get_template_directory_uri(); ?>/fonts/roboto-400.woff2" as="font" type="font/woff2" crossorigin>
|
||||
<link rel="preload" href="<?php echo zeitfresser_asset('/fonts/oswald-400.woff2'); ?>" as="font" type="font/woff2" crossorigin>
|
||||
<link rel="preload" href="<?php echo zeitfresser_asset('/fonts/oswald-700.woff2'); ?>" as="font" type="font/woff2" crossorigin>
|
||||
<link rel="preload" href="<?php echo zeitfresser_asset('/fonts/roboto-400.woff2'); ?>" as="font" type="font/woff2" crossorigin>
|
||||
<link rel="preload" href="<?php echo zeitfresser_asset('/fonts/roboto-500.woff2'); ?>" as="font" type="font/woff2" crossorigin>
|
||||
<?php
|
||||
}
|
||||
add_action('wp_head', 'zeitfresser_preload_fonts', 1);
|
||||
add_action('wp_head', 'zeitfresser_preload_fonts', 0);
|
||||
|
||||
/**
|
||||
* Optimize font loading with preconnect
|
||||
@@ -368,72 +429,61 @@ add_filter( 'wp_resource_hints', function( $urls, $relation_type ) {
|
||||
}, 10, 2 );
|
||||
|
||||
/**
|
||||
* Remove front-end dashicons for visitors.
|
||||
* ------------------------------------------------------------------------
|
||||
* Critical CSS (inline for faster first render)
|
||||
* ------------------------------------------------------------------------
|
||||
*
|
||||
* @return void
|
||||
* We inline only the minimal CSS required for initial layout.
|
||||
* This ensures the page structure renders immediately without
|
||||
* waiting for the full stylesheet.
|
||||
*/
|
||||
function zeitfresser_maybe_dequeue_dashicons() {
|
||||
if ( ! is_user_logged_in() ) {
|
||||
wp_deregister_style( 'dashicons' );
|
||||
function zeitfresser_inline_critical_css() {
|
||||
?>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
background: #1e1f29;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: var(--container-width, 1140px);
|
||||
margin: 0 auto;
|
||||
padding: 0 70px;
|
||||
}
|
||||
|
||||
@media (max-width: 800px) {
|
||||
.container {
|
||||
padding: 0 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.custom-grid-view {
|
||||
display: grid;
|
||||
}
|
||||
|
||||
header.site-header {
|
||||
background: var(--light-color);
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
add_action('wp_head', 'zeitfresser_inline_critical_css', 1);
|
||||
|
||||
function zeitfresser_performance_setup() {
|
||||
if ( ! is_admin() ) {
|
||||
wp_deregister_script( 'wp-embed' );
|
||||
}
|
||||
}
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_maybe_dequeue_dashicons', 100 );
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_performance_setup', 100 );
|
||||
|
||||
/**
|
||||
* Improve image decoding defaults without changing visual output.
|
||||
*
|
||||
* @param array $attr Image markup attributes.
|
||||
* @param WP_Post $attachment Attachment post object.
|
||||
* @param string|array $size Requested image size.
|
||||
* @return array
|
||||
*/
|
||||
function zeitfresser_optimize_image_attributes( $attr, $attachment, $size ) {
|
||||
if ( empty( $attr['decoding'] ) ) {
|
||||
$attr['decoding'] = 'async';
|
||||
}
|
||||
|
||||
if ( empty( $attr['loading'] ) && ! is_admin() ) {
|
||||
$attr['loading'] = 'lazy';
|
||||
}
|
||||
|
||||
return $attr;
|
||||
function zeitfresser_cleanup_wp_head() {
|
||||
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
|
||||
remove_action( 'wp_print_styles', 'print_emoji_styles' );
|
||||
remove_action( 'wp_head', 'rsd_link' );
|
||||
remove_action( 'wp_head', 'wlwmanifest_link' );
|
||||
remove_action( 'wp_head', 'wp_generator' );
|
||||
}
|
||||
add_filter( 'wp_get_attachment_image_attributes', 'zeitfresser_optimize_image_attributes', 10, 3 );
|
||||
|
||||
/**
|
||||
* Lower the threshold for WordPress scaled originals when auto optimization is enabled.
|
||||
*
|
||||
* When automatic optimization is disabled, original uploads should remain untouched.
|
||||
*
|
||||
* @return int|false
|
||||
*/
|
||||
function zeitfresser_big_image_size_threshold() {
|
||||
|
||||
if ( ! get_theme_mod( 'ztfr_auto_optimize', true ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return 1800;
|
||||
}
|
||||
add_filter( 'big_image_size_threshold', 'zeitfresser_big_image_size_threshold' );
|
||||
|
||||
/**
|
||||
* Skip generating oversized core intermediate sizes we do not use.
|
||||
*
|
||||
* @param array $sizes Registered intermediate sizes.
|
||||
* @return array
|
||||
*/
|
||||
function zeitfresser_filter_intermediate_image_sizes( $sizes ) {
|
||||
|
||||
// Remove oversized defaults
|
||||
unset(
|
||||
$sizes['1536x1536'],
|
||||
$sizes['2048x2048']
|
||||
);
|
||||
|
||||
return $sizes;
|
||||
}
|
||||
add_filter( 'intermediate_image_sizes_advanced', 'zeitfresser_filter_intermediate_image_sizes' );
|
||||
add_action( 'init', 'zeitfresser_cleanup_wp_head' );
|
||||
|
||||
/**
|
||||
* Convert generated JPEG and PNG files to AVIF/WebP when enabled.
|
||||
@@ -513,12 +563,12 @@ add_filter(
|
||||
|
||||
function zeitfresser_auto_optimize_on_upload( $metadata, $attachment_id ) {
|
||||
|
||||
// 🔒 only images
|
||||
// Only images
|
||||
if ( ! wp_attachment_is_image( $attachment_id ) ) {
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
// 🔒 feature toggle
|
||||
// Feature toggle
|
||||
if ( ! get_theme_mod( 'ztfr_auto_optimize', true ) ) {
|
||||
return $metadata;
|
||||
}
|
||||
@@ -529,14 +579,12 @@ function zeitfresser_auto_optimize_on_upload( $metadata, $attachment_id ) {
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
// 🔥 DO NOT overwrite upload-captured original
|
||||
// DO NOT overwrite captured original
|
||||
if ( ! get_post_meta( $attachment_id, '_zeitfresser_original_file', true ) ) {
|
||||
|
||||
// fallback only
|
||||
update_post_meta( $attachment_id, '_zeitfresser_original_file', $file );
|
||||
}
|
||||
|
||||
// mark as optimized
|
||||
// Mark optimized (IMPORTANT: no re-trigger here)
|
||||
update_post_meta(
|
||||
$attachment_id,
|
||||
'_zeitfresser_media_optimized_version',
|
||||
@@ -562,11 +610,10 @@ function zeitfresser_auto_delete_original_after_upload( $metadata, $attachment_i
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
if ( ! get_theme_mod( 'ztfr_auto_optimize', true ) ) {
|
||||
return $metadata;
|
||||
}
|
||||
$auto_enabled = get_theme_mod( 'ztfr_auto_optimize', true );
|
||||
$delete_enabled = get_theme_mod( 'ztfr_auto_delete', false );
|
||||
|
||||
if ( ! get_theme_mod( 'ztfr_auto_delete', false ) ) {
|
||||
if ( ! $auto_enabled || ! $delete_enabled ) {
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
@@ -582,20 +629,22 @@ function zeitfresser_auto_delete_original_after_upload( $metadata, $attachment_i
|
||||
|
||||
$ext = strtolower( pathinfo( $original, PATHINFO_EXTENSION ) );
|
||||
|
||||
// Skip modern formats
|
||||
if ( in_array( $ext, [ 'webp', 'avif' ], true ) ) {
|
||||
update_post_meta( $attachment_id, '_zeitfresser_original_deleted', 1 );
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
// If nothing remains, mark as completed.
|
||||
// 🔥 Wenn nichts mehr existiert → fertig
|
||||
if ( ! zeitfresser_original_family_exists( $attachment_id, $original ) ) {
|
||||
update_post_meta( $attachment_id, '_zeitfresser_original_deleted', 1 );
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
// 🔥 HIER passiert der Fix
|
||||
zeitfresser_delete_original_family_files( $attachment_id, $original );
|
||||
|
||||
// Only mark as deleted when all original-format files are gone.
|
||||
// Final check
|
||||
if ( ! zeitfresser_original_family_exists( $attachment_id, $original ) ) {
|
||||
update_post_meta( $attachment_id, '_zeitfresser_original_deleted', 1 );
|
||||
}
|
||||
@@ -612,56 +661,21 @@ function zeitfresser_auto_delete_original_after_upload( $metadata, $attachment_i
|
||||
*/
|
||||
function zeitfresser_image_quality( $quality, $mime_type = 'image/jpeg' ) {
|
||||
|
||||
switch ( $mime_type ) {
|
||||
case 'image/avif':
|
||||
return 50;
|
||||
$auto_enabled = get_theme_mod( 'ztfr_auto_optimize', true );
|
||||
$force_enabled = ! empty( $GLOBALS['zeitfresser_force_image_optimization'] );
|
||||
|
||||
case 'image/webp':
|
||||
return 75;
|
||||
|
||||
case 'image/jpeg':
|
||||
default:
|
||||
return 82;
|
||||
if ( ! $auto_enabled && ! $force_enabled ) {
|
||||
return $quality;
|
||||
}
|
||||
|
||||
return match ($mime_type) {
|
||||
'image/avif' => 50,
|
||||
'image/webp' => 75,
|
||||
default => 82,
|
||||
};
|
||||
}
|
||||
add_filter( 'wp_editor_set_quality', 'zeitfresser_image_quality', 10, 2 );
|
||||
|
||||
/**
|
||||
* Improve attachment image attributes for layout stability and fetch priority.
|
||||
*
|
||||
* @param array $attr Image markup attributes.
|
||||
* @param WP_Post $attachment Attachment post object.
|
||||
* @param string|array $size Requested image size.
|
||||
* @return array
|
||||
*/
|
||||
function zeitfresser_improve_attachment_dimensions( $attr, $attachment, $size ) {
|
||||
if ( empty( $attr['width'] ) || empty( $attr['height'] ) ) {
|
||||
$metadata = wp_get_attachment_metadata( $attachment->ID );
|
||||
|
||||
if ( is_array( $metadata ) && ! empty( $metadata['width'] ) && ! empty( $metadata['height'] ) ) {
|
||||
if ( empty( $attr['width'] ) ) {
|
||||
$attr['width'] = (int) $metadata['width'];
|
||||
}
|
||||
|
||||
if ( empty( $attr['height'] ) ) {
|
||||
$attr['height'] = (int) $metadata['height'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $attr['fetchpriority'] ) && ! is_admin() && ! is_feed() ) {
|
||||
static $did_set_high_priority = false;
|
||||
|
||||
if ( ! $did_set_high_priority && is_singular() ) {
|
||||
$attr['fetchpriority'] = 'high';
|
||||
$did_set_high_priority = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $attr;
|
||||
}
|
||||
add_filter( 'wp_get_attachment_image_attributes', 'zeitfresser_improve_attachment_dimensions', 11, 3 );
|
||||
|
||||
/**
|
||||
* Improve responsive image sizes attribute.
|
||||
*
|
||||
@@ -684,111 +698,3 @@ function zeitfresser_responsive_image_sizes( $sizes, $size ) {
|
||||
return $sizes;
|
||||
}
|
||||
add_filter( 'wp_calculate_image_sizes', 'zeitfresser_responsive_image_sizes', 10, 2 );
|
||||
|
||||
/**
|
||||
* Determine the most likely LCP image URL.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function zeitfresser_get_lcp_image_url() {
|
||||
|
||||
// Single posts/pages → featured image
|
||||
if ( is_singular() ) {
|
||||
$post_id = get_queried_object_id();
|
||||
|
||||
if ( $post_id && has_post_thumbnail( $post_id ) ) {
|
||||
return get_the_post_thumbnail_url( $post_id, 'large' );
|
||||
}
|
||||
}
|
||||
|
||||
// Archives / homepage → first post with thumbnail
|
||||
if ( is_home() || is_front_page() || is_archive() || is_search() ) {
|
||||
|
||||
global $wp_query;
|
||||
|
||||
if ( ! empty( $wp_query->posts ) ) {
|
||||
|
||||
foreach ( $wp_query->posts as $post ) {
|
||||
if ( has_post_thumbnail( $post->ID ) ) {
|
||||
return get_the_post_thumbnail_url( $post->ID, 'medium_large' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Preload the most likely LCP image for archive and singular views.
|
||||
*
|
||||
* @param array $resources Existing preload resources.
|
||||
* @return array
|
||||
*/
|
||||
function zeitfresser_preload_resources( $resources ) {
|
||||
|
||||
if ( is_admin() || is_feed() || is_embed() ) {
|
||||
return $resources;
|
||||
}
|
||||
|
||||
// 🔥 NEW: use smart detection
|
||||
$image_url = zeitfresser_get_lcp_image_url();
|
||||
|
||||
if ( empty( $image_url ) ) {
|
||||
return $resources;
|
||||
}
|
||||
|
||||
// Robust extension detection
|
||||
$extension = strtolower(
|
||||
pathinfo(
|
||||
wp_parse_url( $image_url, PHP_URL_PATH ),
|
||||
PATHINFO_EXTENSION
|
||||
)
|
||||
);
|
||||
|
||||
// MIME fallback
|
||||
$image_type = 'image/jpeg';
|
||||
|
||||
if ( 'png' === $extension ) {
|
||||
$image_type = 'image/png';
|
||||
} elseif ( 'webp' === $extension ) {
|
||||
$image_type = 'image/webp';
|
||||
} elseif ( 'avif' === $extension ) {
|
||||
$image_type = 'image/avif';
|
||||
}
|
||||
|
||||
$resources[] = array_filter(
|
||||
array(
|
||||
'href' => esc_url( $image_url ),
|
||||
'as' => 'image',
|
||||
'type' => $image_type,
|
||||
'fetchpriority' => 'high',
|
||||
)
|
||||
);
|
||||
|
||||
return $resources;
|
||||
}
|
||||
add_filter( 'wp_preload_resources', 'zeitfresser_preload_resources' );
|
||||
|
||||
/**
|
||||
* Improve script loading strategy for non-critical assets.
|
||||
*
|
||||
* @param array $tag Script tag markup.
|
||||
* @param string $handle Script handle.
|
||||
* @param string $src Script source URL.
|
||||
* @return string
|
||||
*/
|
||||
function zeitfresser_defer_non_critical_scripts( $tag, $handle, $src ) {
|
||||
$deferred_handles = array(
|
||||
'zeitfresser-navigation',
|
||||
'zeitfresser-masonry',
|
||||
'zeitfresser-scripts',
|
||||
);
|
||||
|
||||
if ( in_array( $handle, $deferred_handles, true ) && false === strpos( $tag, ' defer' ) ) {
|
||||
return str_replace( ' src=', ' defer src=', $tag );
|
||||
}
|
||||
|
||||
return $tag;
|
||||
}
|
||||
add_filter( 'script_loader_tag', 'zeitfresser_defer_non_critical_scripts', 10, 3 );
|
||||
|
||||
+51
-48
@@ -2,13 +2,8 @@
|
||||
/**
|
||||
* The header for our theme
|
||||
*
|
||||
* This is the template that displays all of the <head> section and everything up until <div id="content">
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
?>
|
||||
<!doctype html>
|
||||
<html <?php language_attributes(); ?>>
|
||||
@@ -22,60 +17,68 @@
|
||||
</head>
|
||||
|
||||
<body <?php body_class(); ?>>
|
||||
<?php wp_body_open(); ?>
|
||||
<a class="skip-link screen-reader-text" href="#primary"><?php esc_html_e( 'Skip to content', 'zeitfresser' ); ?></a>
|
||||
<?php wp_body_open(); ?>
|
||||
|
||||
<a class="skip-link screen-reader-text" href="#primary">
|
||||
<?php esc_html_e( 'Skip to content', 'zeitfresser' ); ?>
|
||||
</a>
|
||||
|
||||
<header id="masthead" class="site-header">
|
||||
<header id="masthead" class="site-header">
|
||||
|
||||
<div class="header-wrapper">
|
||||
<div class="container">
|
||||
<div class="site-header-wrapper">
|
||||
<div class="site-branding">
|
||||
<div class="header-wrapper">
|
||||
<div class="container">
|
||||
<div class="site-header-wrapper">
|
||||
|
||||
<?php the_custom_logo(); ?>
|
||||
<div class="site-branding">
|
||||
|
||||
<div class="site-identity">
|
||||
<?php the_custom_logo(); ?>
|
||||
|
||||
<?php if( get_theme_mod( 'show_hide_site_title', zeitfresser_get_default_site_title_show_hide() ) ) { ?>
|
||||
<div class="site-identity">
|
||||
|
||||
<?php if ( get_theme_mod( 'show_hide_site_title', true ) ) : ?>
|
||||
<div class="site-title">
|
||||
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"
|
||||
class="logo"><?php bloginfo( 'name' ); ?></a>
|
||||
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" class="logo">
|
||||
<?php bloginfo( 'name' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( get_theme_mod( 'show_hide_site_tagline', true ) ) : ?>
|
||||
<div class="site-description">
|
||||
<?php bloginfo( 'description' ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php $daisy_blog_description = get_bloginfo( 'description' ); ?>
|
||||
<?php if( get_theme_mod( 'show_hide_site_tagline', zeitfresser_get_default_site_tagline_show_hide() ) ) { ?>
|
||||
<div class="site-description"><?php echo $daisy_blog_description; ?></div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</div><!-- .site-branding -->
|
||||
|
||||
<div class="nav-social-links">
|
||||
<nav id="site-navigation" class="main-navigation">
|
||||
<button id="nav-icon3" class="menu-toggle" aria-controls="primary-menu"
|
||||
aria-expanded="false">
|
||||
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
</button>
|
||||
<?php
|
||||
wp_nav_menu(
|
||||
array(
|
||||
'theme_location' => 'menu-1',
|
||||
'menu_id' => 'primary-menu',
|
||||
)
|
||||
);
|
||||
?>
|
||||
</nav><!-- #site-navigation -->
|
||||
|
||||
<?php get_template_part( 'template-parts/social', 'links' ); ?>
|
||||
</div>
|
||||
|
||||
</div><!-- .site-branding -->
|
||||
|
||||
<div class="nav-social-links">
|
||||
|
||||
<nav id="site-navigation" class="main-navigation">
|
||||
<button id="nav-icon3" class="menu-toggle" aria-controls="primary-menu" aria-expanded="false">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
</button>
|
||||
|
||||
<?php
|
||||
wp_nav_menu(
|
||||
array(
|
||||
'theme_location' => 'menu-1',
|
||||
'menu_id' => 'primary-menu',
|
||||
)
|
||||
);
|
||||
?>
|
||||
</nav>
|
||||
|
||||
<?php get_template_part( 'template-parts/social', 'links' ); ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</header><!-- #masthead -->
|
||||
</div>
|
||||
|
||||
</header><!-- #masthead -->
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Register customizer blocks used by the Zeitfresser theme.
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ZEITFRESSER_BLOCKS_DIR_PATH' ) ) {
|
||||
define( 'ZEITFRESSER_BLOCKS_DIR_PATH', dirname( __FILE__ ) );
|
||||
}
|
||||
|
||||
if ( ! defined( 'DAISY_BLOG_BLOCKS_DIR_PATH' ) ) {
|
||||
define( 'DAISY_BLOG_BLOCKS_DIR_PATH', ZEITFRESSER_BLOCKS_DIR_PATH );
|
||||
}
|
||||
|
||||
require dirname( __FILE__ ) . '/includes/sanitize.php';
|
||||
require dirname( __FILE__ ) . '/includes/register-controls.php';
|
||||
|
||||
require dirname( __FILE__ ) . '/site-identity/site-identity.php';
|
||||
require dirname( __FILE__ ) . '/general/general.php';
|
||||
require dirname( __FILE__ ) . '/post-detail/post-detail.php';
|
||||
require dirname( __FILE__ ) . '/footer-copyright/footer-copyright.php';
|
||||
@@ -1,5 +0,0 @@
|
||||
<?php
|
||||
|
||||
function zeitfresser_get_default_footer_copyright() {
|
||||
return "Zeitfresser ©";
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
/* Add Default Copyright Text */
|
||||
require dirname( __FILE__ ) . '/default-footer-copyright.php';
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_customize_register_footer_copyright' );
|
||||
function zeitfresser_customize_register_footer_copyright( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_section( 'daisy_blog_footer_copyright_section', array(
|
||||
'title' => esc_html__( 'Footer Copyright', 'zeitfresser' ),
|
||||
'priority' => 24
|
||||
) );
|
||||
|
||||
$wp_customize->add_setting( 'footer_copyright_text', array(
|
||||
'sanitize_callback' => 'wp_kses_post',
|
||||
'default' => zeitfresser_get_default_footer_copyright()
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( 'footer_copyright_text', array(
|
||||
'label' => esc_html__( 'Copyright Text', 'zeitfresser' ),
|
||||
'section' => 'daisy_blog_footer_copyright_section',
|
||||
'settings' => 'footer_copyright_text',
|
||||
'type'=> 'textarea',
|
||||
) );
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_container_width' );
|
||||
function zeitfresser_container_width( $wp_customize ) {
|
||||
|
||||
$general_title = '<hr/><h2>' . esc_html__( 'General:', 'zeitfresser' ) . '</h2>';
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'zeitfresser_general_title',
|
||||
array(
|
||||
'default' => '',
|
||||
'sanitize_callback' => 'wp_kses_post',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Daisy_Blog_Custom_Text(
|
||||
$wp_customize,
|
||||
'zeitfresser_general_title',
|
||||
array(
|
||||
'section' => 'daisy_blog_general_customization_section',
|
||||
'label' => $general_title,
|
||||
'priority' => 5,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting('container_width', array(
|
||||
'default' => zeitfresser_get_default_container_width(),
|
||||
'sanitize_callback' => 'absint',
|
||||
'transport' => 'postMessage',
|
||||
));
|
||||
|
||||
$wp_customize->add_control( 'container_width', array(
|
||||
'label' => esc_html__('Container Width', 'zeitfresser'),
|
||||
'section' => 'daisy_blog_general_customization_section',
|
||||
'type' => 'number',
|
||||
'priority' => 10,
|
||||
'input_attrs' => array(
|
||||
'min' => 1000,
|
||||
'max' => 1600
|
||||
) )
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
add_action( 'customize_preview_init', 'zeitfresser_container_width_enqueue_scripts' );
|
||||
function zeitfresser_container_width_enqueue_scripts() {
|
||||
wp_enqueue_script( 'graphthemes-container-width-customizer', get_template_directory_uri() . '/inc/blocks/general/container-width/customizer-container-width.js', array('jquery'), '', true );
|
||||
}
|
||||
|
||||
|
||||
add_action( 'wp_enqueue_scripts', 'zeitfresser_container_width_dynamic_css' );
|
||||
function zeitfresser_container_width_dynamic_css() {
|
||||
|
||||
$container_width = esc_attr( get_theme_mod( 'container_width', zeitfresser_get_default_container_width() ) );
|
||||
$container_width .= 'px';
|
||||
|
||||
$dynamic_css = ":root { --container-width: $container_width; }";
|
||||
|
||||
wp_add_inline_style( 'zeitfresser', $dynamic_css );
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
jQuery( function( $ ) {
|
||||
|
||||
wp.customize('container_width',function ( value ) {
|
||||
value.bind(function ( to ) {
|
||||
document.body.style.setProperty('--container-width', to+"px");
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
} );
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
/* Default General Customization */
|
||||
|
||||
function zeitfresser_get_default_breadcrumbs() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function zeitfresser_get_default_sticky_menu() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function zeitfresser_get_default_container_width() {
|
||||
return 1400;
|
||||
}
|
||||
|
||||
function zeitfresser_get_default_show_article_toc() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function zeitfresser_get_default_article_toc_min_headlines() {
|
||||
return 3;
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* General customizer section.
|
||||
*/
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_register_general_customization_section' );
|
||||
|
||||
/**
|
||||
* Register the general options section.
|
||||
*
|
||||
* @param WP_Customize_Manager $wp_customize Customizer manager.
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_register_general_customization_section( $wp_customize ) {
|
||||
$wp_customize->add_section(
|
||||
'daisy_blog_general_customization_section',
|
||||
array(
|
||||
'title' => esc_html__( 'General Options', 'zeitfresser' ),
|
||||
'priority' => 21,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
require dirname( __FILE__ ) . '/default-general.php';
|
||||
require dirname( __FILE__ ) . '/container-width/container-width.php';
|
||||
require dirname( __FILE__ ) . '/social-links/social-links.php';
|
||||
require dirname( __FILE__ ) . '/toc-options.php';
|
||||
|
||||
require dirname( __FILE__ ) . '/../post-snippet/default-post-snippet.php';
|
||||
require dirname( __FILE__ ) . '/../post-snippet/excerpt/excerpt.php';
|
||||
@@ -1,99 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* TOC related general settings.
|
||||
*/
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_register_article_toc_options' );
|
||||
|
||||
/**
|
||||
* Sanitize the minimum heading threshold for the article TOC.
|
||||
*
|
||||
* @param mixed $value Submitted control value.
|
||||
* @return int
|
||||
*/
|
||||
function zeitfresser_sanitize_article_toc_min_headlines( $value ) {
|
||||
$value = absint( $value );
|
||||
|
||||
if ( $value < 1 ) {
|
||||
$value = zeitfresser_get_default_article_toc_min_headlines();
|
||||
}
|
||||
|
||||
return min( 50, $value );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register article TOC options in General Options.
|
||||
*
|
||||
* @param WP_Customize_Manager $wp_customize Customizer manager.
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_register_article_toc_options( $wp_customize ) {
|
||||
$article_toc_title = '<hr/><h2>' . esc_html__( 'Article TOC:', 'zeitfresser' ) . '</h2>';
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'article_toc_options_heading',
|
||||
array(
|
||||
'sanitize_callback' => 'wp_kses_post',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Daisy_Blog_Custom_Text(
|
||||
$wp_customize,
|
||||
'article_toc_options_heading',
|
||||
array(
|
||||
'section' => 'daisy_blog_general_customization_section',
|
||||
'label' => $article_toc_title,
|
||||
'priority' => 12,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'show_article_toc',
|
||||
array(
|
||||
'sanitize_callback' => 'zeitfresser_sanitize_checkbox',
|
||||
'default' => zeitfresser_get_default_show_article_toc(),
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Graphthemes_Toggle_Control(
|
||||
$wp_customize,
|
||||
'show_article_toc',
|
||||
array(
|
||||
'settings' => 'show_article_toc',
|
||||
'section' => 'daisy_blog_general_customization_section',
|
||||
'label' => esc_html__( 'Show Article TOC', 'zeitfresser' ),
|
||||
'description' => esc_html__( 'Enable the floating article TOC on single posts. Default: enabled.', 'zeitfresser' ),
|
||||
'type' => 'toggle',
|
||||
'priority' => 13,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'article_toc_min_headlines',
|
||||
array(
|
||||
'sanitize_callback' => 'zeitfresser_sanitize_article_toc_min_headlines',
|
||||
'default' => zeitfresser_get_default_article_toc_min_headlines(),
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'article_toc_min_headlines',
|
||||
array(
|
||||
'settings' => 'article_toc_min_headlines',
|
||||
'type' => 'number',
|
||||
'section' => 'daisy_blog_general_customization_section',
|
||||
'label' => esc_html__( 'Number of Headlines to Start TOC', 'zeitfresser' ),
|
||||
'description' => esc_html__( 'The article TOC is shown only when this number of headings or more is found. Default: 3.', 'zeitfresser' ),
|
||||
'priority' => 14,
|
||||
'input_attrs' => array(
|
||||
'min' => 1,
|
||||
'max' => 50,
|
||||
'step' => 1,
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
#customize-controls .control-section-button .accordion-section-title:hover,
|
||||
#customize-controls .control-section-button .accordion-section-title:focus {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.control-section-button .accordion-section-title .button {
|
||||
margin-top: -4px;
|
||||
font-weight: 400;
|
||||
margin-left: 8px;
|
||||
background: #e45157;
|
||||
border: none;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.rtl .control-section-button .accordion-section-title .button {
|
||||
margin-left: 0;
|
||||
margin-right: 8px;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
(function (api) {
|
||||
if (api != null) {
|
||||
// Extends our custom "upgrade-to-pro" section.
|
||||
api.sectionConstructor["button"] = api.Section.extend({
|
||||
// No events for this type of section.
|
||||
attachEvents: function () {},
|
||||
|
||||
// Always make the section active.
|
||||
isContextuallyActive: function () {
|
||||
return true;
|
||||
},
|
||||
});
|
||||
} else {
|
||||
}
|
||||
})(wp.customize);
|
||||
@@ -1,74 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Pro customizer section.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
*/
|
||||
class Daisy_Blog_Button_Control extends WP_Customize_Section {
|
||||
/**
|
||||
* The type of customize section being rendered.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'button';
|
||||
|
||||
/**
|
||||
* Custom button text to output.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $pro_text = '';
|
||||
|
||||
/**
|
||||
* Custom pro button URL.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $pro_url = '';
|
||||
|
||||
/**
|
||||
* Add custom parameters to pass to the JS via JSON.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public function json() {
|
||||
$json = parent::json();
|
||||
|
||||
$json['pro_text'] = $this->pro_text;
|
||||
$json['pro_url'] = esc_url( $this->pro_url );
|
||||
|
||||
return $json;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Outputs the Underscore.js template.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
protected function render_template() { ?>
|
||||
|
||||
<li id="accordion-section-{{ data.id }}" class="accordion-section control-section control-section-{{ data.type }} cannot-expand">
|
||||
|
||||
<h3 class="accordion-section-title">
|
||||
{{ data.title }}
|
||||
|
||||
<# if ( data.pro_text && data.pro_url ) { #>
|
||||
<a href="{{ data.pro_url }}" class="button button-secondary alignright" target="_blank">{{ data.pro_text }}</a>
|
||||
<# } #>
|
||||
</h3>
|
||||
</li>
|
||||
<?php }
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
if( class_exists( 'WP_Customize_control' ) ){
|
||||
|
||||
class Daisy_Blog_Custom_Text extends WP_Customize_Control
|
||||
{
|
||||
/**
|
||||
* Render the content on the theme customizer page
|
||||
*/
|
||||
public function render_content()
|
||||
{
|
||||
?>
|
||||
<label>
|
||||
<strong class="customize-text_editor"><?php echo wp_kses_post( $this->label ); ?></strong>
|
||||
<br />
|
||||
<span class="customize-text_editor_desc">
|
||||
<?php echo wp_kses_post( $this->description ); ?>
|
||||
</span>
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
}//editor close
|
||||
|
||||
}//class close
|
||||
@@ -1,86 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Customizer Control: multi-check
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Graphthemes_Multi_Check_Control' ) ) {
|
||||
|
||||
/**
|
||||
* Adds a multicheck control.
|
||||
*/
|
||||
class Graphthemes_Multi_Check_Control extends Wp_Customize_Control {
|
||||
|
||||
/**
|
||||
* The control type.
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'multi-check';
|
||||
|
||||
public $tooltip = '';
|
||||
|
||||
public function to_json() {
|
||||
parent::to_json();
|
||||
|
||||
if ( isset( $this->default ) ) {
|
||||
$this->json['default'] = $this->default;
|
||||
} else {
|
||||
$this->json['default'] = $this->setting->default;
|
||||
}
|
||||
|
||||
$this->json['value'] = $this->value();
|
||||
$this->json['choices'] = $this->choices;
|
||||
$this->json['link'] = $this->get_link();
|
||||
$this->json['id'] = $this->id;
|
||||
$this->json['tooltip'] = $this->tooltip;
|
||||
|
||||
$this->json['inputAttrs'] = '';
|
||||
foreach ( $this->input_attrs as $attr => $value ) {
|
||||
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
}
|
||||
|
||||
public function enqueue() {
|
||||
wp_enqueue_script( 'graphthemes-multi-check', get_template_directory_uri() . '/inc/blocks/includes/multicheck/multi-check.js', array( 'jquery' ), false, true );
|
||||
}
|
||||
|
||||
|
||||
protected function content_template() {
|
||||
?>
|
||||
|
||||
<# if ( ! data.choices ) { return; } #>
|
||||
|
||||
<# if ( data.tooltip ) { #>
|
||||
<a href="#" class="tooltip hint--left" data-hint="{{ data.tooltip }}"><span class='dashicons dashicons-info'></span></a>
|
||||
<# } #>
|
||||
|
||||
<# if ( data.label ) { #>
|
||||
<span class="customize-control-title">{{ data.label }}</span>
|
||||
<# } #>
|
||||
|
||||
<# if ( data.description ) { #>
|
||||
<span class="description customize-control-description">{{{ data.description }}}</span>
|
||||
<# } #>
|
||||
|
||||
<ul>
|
||||
<# for ( key in data.choices ) { #>
|
||||
<li>
|
||||
<label>
|
||||
<input type="checkbox" value="{{ key }}"<# if ( _.contains( data.value, key ) ) { #> checked<# } #> />
|
||||
{{ data.choices[ key ] }}
|
||||
</label>
|
||||
</li>
|
||||
<# } #>
|
||||
</ul>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
wp.customize.controlConstructor['multi-check'] = wp.customize.Control.extend({
|
||||
|
||||
// When we're finished loading continue processing.
|
||||
ready: function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
var control = this;
|
||||
|
||||
// Save the value
|
||||
control.container.on( 'change', 'input', function() {
|
||||
var value = [],
|
||||
i = 0;
|
||||
|
||||
// Build the value as an object using the sub-values from individual checkboxes.
|
||||
jQuery.each( control.params.choices, function( key, subValue ) {
|
||||
if ( control.container.find( 'input[value="' + key + '"]' ).is( ':checked' ) ) {
|
||||
value[ i ] = key;
|
||||
i++;
|
||||
}
|
||||
});
|
||||
|
||||
// Update the value in the customizer.
|
||||
control.setting.set( value );
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_register_custom_controls' );
|
||||
function zeitfresser_register_custom_controls( $wp_customize ) {
|
||||
|
||||
require_once ZEITFRESSER_BLOCKS_DIR_PATH . '/includes/button/class-button-control.php';
|
||||
$wp_customize->register_control_type( 'Daisy_Blog_Button_Control' );
|
||||
|
||||
require_once ZEITFRESSER_BLOCKS_DIR_PATH . '/includes//custom-html/class-custom-html.php';
|
||||
|
||||
require_once ZEITFRESSER_BLOCKS_DIR_PATH . '/includes/toggle/class-toggle-control.php';
|
||||
$wp_customize->register_control_type( 'Graphthemes_Toggle_Control' );
|
||||
|
||||
require_once ZEITFRESSER_BLOCKS_DIR_PATH . '/includes//multicheck/class-multi-check-control.php';
|
||||
$wp_customize->register_control_type( 'Graphthemes_Multi_Check_Control' );
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
/* Sanitize Google Fonts */
|
||||
function zeitfresser_sanitize_google_fonts( $input, $setting ) {
|
||||
|
||||
// Get list of choices from the control associated with the setting.
|
||||
$choices = $setting->manager->get_control( $setting->id )->choices;
|
||||
|
||||
// If the input is a valid key, return it; otherwise, return the default.
|
||||
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
|
||||
|
||||
}
|
||||
|
||||
|
||||
function zeitfresser_sanitize_float( $input ) {
|
||||
return filter_var($input, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//checkbox sanitization function
|
||||
function zeitfresser_sanitize_checkbox( $input ) {
|
||||
//returns true if checkbox is checked
|
||||
return ( ( isset( $input ) && true == $input ) ? true : false );
|
||||
}
|
||||
|
||||
|
||||
function zeitfresser_sanitize_select( $input, $setting ) {
|
||||
|
||||
// Ensure input is a slug.
|
||||
$input = sanitize_key( $input );
|
||||
|
||||
// Get list of choices from the control associated with the setting.
|
||||
$choices = $setting->manager->get_control( $setting->id )->choices;
|
||||
|
||||
// If the input is a valid key, return it; otherwise, return the default.
|
||||
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
|
||||
}
|
||||
|
||||
|
||||
function zeitfresser_sanitize_array( $value ){
|
||||
if ( is_array( $value ) ) {
|
||||
foreach ( $value as $key => $subvalue ) {
|
||||
$value[ $key ] = esc_attr( $subvalue );
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
return esc_attr( $value );
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
<script type="text/javascript">
|
||||
var fb = '<?php echo esc_html__( "Facebook", 'zeitfresser' ); ?>';
|
||||
var twitter = '<?php echo esc_html__( "Twitter", 'zeitfresser' ); ?>';
|
||||
var pinterest = '<?php echo esc_html__( "Pinterest", 'zeitfresser' ); ?>';
|
||||
var linkedin = '<?php echo esc_html__( "Linkedin", 'zeitfresser' ); ?>';
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
$url = urlencode(get_the_permalink());
|
||||
$title = html_entity_decode(get_the_title(), ENT_COMPAT, 'UTF-8');
|
||||
$media = urlencode(get_the_post_thumbnail_url(get_the_ID(), 'full'));
|
||||
$twitter_id = get_theme_mod('twitter_id');
|
||||
|
||||
$social_share = $args;
|
||||
?>
|
||||
|
||||
<ul class="list-inline">
|
||||
|
||||
<li><?php esc_html_e( "Share", 'zeitfresser' ); ?>:</li>
|
||||
|
||||
<?php if( in_array( 'facebook', $social_share ) ) { ?>
|
||||
<li><a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $url; ?>" onclick="return ! window.open( this.href, fb, 'width=500, height=500' )">
|
||||
<svg version="1.1" viewBox="0 0 56.693 56.693" width="56.693px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M40.43,21.739h-7.645v-5.014c0-1.883,1.248-2.322,2.127-2.322c0.877,0,5.395,0,5.395,0V6.125l-7.43-0.029 c-8.248,0-10.125,6.174-10.125,10.125v5.518h-4.77v8.53h4.77c0,10.947,0,24.137,0,24.137h10.033c0,0,0-13.32,0-24.137h6.77 L40.43,21.739z"/></svg></a></li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if( in_array( 'twitter', $social_share ) ) { ?>
|
||||
<li><a href="https://twitter.com/intent/tweet?text=<?php echo $title; ?>&url=<?php echo $url; ?>&via=<?php echo esc_html( $twitter_id ); ?>" onclick="return ! window.open( this.href, twitter, 'width=500, height=500' )">
|
||||
<svg version="1.1" viewBox="0 0 512 512" width="512px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M492,109.5c-17.4,7.7-36,12.9-55.6,15.3c20-12,35.4-31,42.6-53.6c-18.7,11.1-39.4,19.2-61.5,23.5 C399.8,75.8,374.6,64,346.8,64c-53.5,0-96.8,43.4-96.8,96.9c0,7.6,0.8,15,2.5,22.1C172,179,100.6,140.4,52.9,81.7 c-8.3,14.3-13.1,31-13.1,48.7c0,33.6,17.1,63.3,43.1,80.7C67,210.7,52,206.3,39,199c0,0.4,0,0.8,0,1.2c0,47,33.4,86.1,77.7,95 c-8.1,2.2-16.7,3.4-25.5,3.4c-6.2,0-12.3-0.6-18.2-1.8c12.3,38.5,48.1,66.5,90.5,67.3c-33.1,26-74.9,41.5-120.3,41.5 c-7.8,0-15.5-0.5-23.1-1.4C62.9,432,113.8,448,168.4,448C346.6,448,444,300.3,444,172.2c0-4.2-0.1-8.4-0.3-12.5 C462.6,146,479,128.9,492,109.5z"/></svg>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if( in_array( 'pinterest', $social_share ) ) { ?>
|
||||
<li><a href="http://pinterest.com/pin/create/button/?url=<?php echo $url; ?>&media=<?php echo $media; ?>&description=<?php echo esc_html( $title ); ?>" onclick="return ! window.open( this.href, pinterest, 'width=500, height=500' )">
|
||||
<svg viewBox="0 0 24 24" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><path d="M12.486,4.771c-4.23,0-6.363,3.033-6.363,5.562c0,1.533,0.581,2.894,1.823,3.401c0.205,0.084,0.387,0.004,0.446-0.221 c0.041-0.157,0.138-0.553,0.182-0.717c0.061-0.221,0.037-0.3-0.127-0.495c-0.359-0.422-0.588-0.972-0.588-1.747 c0-2.25,1.683-4.264,4.384-4.264c2.392,0,3.706,1.463,3.706,3.412c0,2.568-1.137,4.734-2.824,4.734 c-0.932,0-1.629-0.77-1.405-1.715c0.268-1.13,0.786-2.347,0.786-3.16c0-0.729-0.392-1.336-1.2-1.336 c-0.952,0-1.718,0.984-1.718,2.304c0,0.841,0.286,1.409,0.286,1.409s-0.976,4.129-1.146,4.852c-0.34,1.44-0.051,3.206-0.025,3.385 c0.013,0.104,0.149,0.131,0.21,0.051c0.088-0.115,1.223-1.517,1.607-2.915c0.111-0.396,0.627-2.445,0.627-2.445 c0.311,0.589,1.213,1.108,2.175,1.108c2.863,0,4.804-2.608,4.804-6.103C18.123,7.231,15.886,4.771,12.486,4.771z"/></g></svg>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if( in_array( 'linkedin', $social_share ) ) { ?>
|
||||
<li><a href="https://www.linkedin.com/shareArticle?mini=true&url=<?php echo $url; ?>&title=<?php echo esc_html( $title ); ?>" onclick="return ! window.open( this.href, linkedin, 'width=500, height=500' )">
|
||||
<svg baseProfile="tiny" version="1.2" viewBox="0 0 24 24" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><path d="M8,19H5V9h3V19z M19,19h-3v-5.342c0-1.392-0.496-2.085-1.479-2.085c-0.779,0-1.273,0.388-1.521,1.165C13,14,13,19,13,19h-3 c0,0,0.04-9,0-10h2.368l0.183,2h0.062c0.615-1,1.598-1.678,2.946-1.678c1.025,0,1.854,0.285,2.487,1.001 C18.683,11.04,19,12.002,19,13.353V19z"/></g><g><ellipse cx="6.5" cy="6.5" rx="1.55" ry="1.5"/></g></svg>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php if( in_array( 'email', $social_share ) ) { ?>
|
||||
<li><a href="mailto:?subject=<?php echo esc_attr( $title ); ?>&body=<?php echo $title . " " . $url; ?>" target="_blank">
|
||||
<svg version="1.1" viewBox="0 0 100.354 100.352" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M93.09,76.224c0.047-0.145,0.079-0.298,0.079-0.459V22.638c0-0.162-0.032-0.316-0.08-0.462 c-0.007-0.02-0.011-0.04-0.019-0.06c-0.064-0.171-0.158-0.325-0.276-0.46c-0.008-0.009-0.009-0.02-0.017-0.029 c-0.005-0.005-0.011-0.007-0.016-0.012c-0.126-0.134-0.275-0.242-0.442-0.323c-0.013-0.006-0.023-0.014-0.036-0.02 c-0.158-0.071-0.33-0.111-0.511-0.123c-0.018-0.001-0.035-0.005-0.053-0.005c-0.017-0.001-0.032-0.005-0.049-0.005H8.465 c-0.017,0-0.033,0.004-0.05,0.005c-0.016,0.001-0.032,0.004-0.048,0.005c-0.183,0.012-0.358,0.053-0.518,0.125 c-0.01,0.004-0.018,0.011-0.028,0.015c-0.17,0.081-0.321,0.191-0.448,0.327c-0.005,0.005-0.011,0.006-0.016,0.011 c-0.008,0.008-0.009,0.019-0.017,0.028c-0.118,0.135-0.213,0.29-0.277,0.461c-0.008,0.02-0.012,0.04-0.019,0.061 c-0.048,0.146-0.08,0.3-0.08,0.462v53.128c0,0.164,0.033,0.32,0.082,0.468c0.007,0.02,0.011,0.039,0.018,0.059 c0.065,0.172,0.161,0.327,0.28,0.462c0.007,0.008,0.009,0.018,0.016,0.026c0.006,0.007,0.014,0.011,0.021,0.018 c0.049,0.051,0.103,0.096,0.159,0.14c0.025,0.019,0.047,0.042,0.073,0.06c0.066,0.046,0.137,0.083,0.21,0.117 c0.018,0.008,0.034,0.021,0.052,0.028c0.181,0.077,0.38,0.121,0.589,0.121h83.204c0.209,0,0.408-0.043,0.589-0.121 c0.028-0.012,0.054-0.03,0.081-0.044c0.062-0.031,0.124-0.063,0.181-0.102c0.03-0.021,0.057-0.048,0.086-0.071 c0.051-0.041,0.101-0.082,0.145-0.129c0.008-0.008,0.017-0.014,0.025-0.022c0.008-0.009,0.01-0.021,0.018-0.03 c0.117-0.134,0.211-0.288,0.275-0.458C93.078,76.267,93.083,76.246,93.09,76.224z M9.965,26.04l25.247,23.061L9.965,72.346V26.04z M61.711,47.971c-0.104,0.068-0.214,0.125-0.301,0.221c-0.033,0.036-0.044,0.083-0.073,0.121l-11.27,10.294L12.331,24.138h75.472 L61.711,47.971z M37.436,51.132l11.619,10.613c0.287,0.262,0.649,0.393,1.012,0.393s0.725-0.131,1.011-0.393l11.475-10.481 l25.243,23.002H12.309L37.436,51.132z M64.778,49.232L90.169,26.04v46.33L64.778,49.232z"/></svg></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
</ul>
|
||||
@@ -1,65 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Customizer Control: toggle.
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'Graphthemes_Toggle_Control' ) ) {
|
||||
|
||||
/**
|
||||
* Toggle control (modified checkbox).
|
||||
*/
|
||||
class Graphthemes_Toggle_Control extends Wp_Customize_Control {
|
||||
|
||||
public $type = 'toggle';
|
||||
|
||||
public $tooltip = '';
|
||||
|
||||
public function to_json() {
|
||||
parent::to_json();
|
||||
|
||||
if ( isset( $this->default ) ) {
|
||||
$this->json['default'] = $this->default;
|
||||
} else {
|
||||
$this->json['default'] = $this->setting->default;
|
||||
}
|
||||
|
||||
$this->json['value'] = $this->value();
|
||||
$this->json['link'] = $this->get_link();
|
||||
$this->json['id'] = $this->id;
|
||||
$this->json['tooltip'] = $this->tooltip;
|
||||
|
||||
$this->json['inputAttrs'] = '';
|
||||
foreach ( $this->input_attrs as $attr => $value ) {
|
||||
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
}
|
||||
|
||||
public function enqueue() {
|
||||
wp_enqueue_style( 'graphthemes-toggle', get_template_directory_uri() . '/inc/blocks/includes/toggle/toggle.css', null );
|
||||
wp_enqueue_script( 'graphthemes-toggle', get_template_directory_uri() . '/inc/blocks/includes/toggle/toggle.js', array( 'jquery' ), false, true ); //for toggle
|
||||
}
|
||||
|
||||
protected function content_template() {
|
||||
?>
|
||||
<# if ( data.tooltip ) { #>
|
||||
<a href="#" class="tooltip hint--left" data-hint="{{ data.tooltip }}"><span class='dashicons dashicons-info'></span></a>
|
||||
<# } #>
|
||||
<label for="toggle_{{ data.id }}">
|
||||
<span class="customize-control-title">
|
||||
{{{ data.label }}}
|
||||
</span>
|
||||
<# if ( data.description ) { #>
|
||||
<span class="description customize-control-description">{{{ data.description }}}</span>
|
||||
<# } #>
|
||||
<input {{{ data.inputAttrs }}} name="toggle_{{ data.id }}" id="toggle_{{ data.id }}" type="checkbox" value="{{ data.value }}" {{{ data.link }}}<# if ( '1' == data.value ) { #> checked<# } #> hidden />
|
||||
<span class="switch"></span>
|
||||
</label>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
.customize-control-toggle label {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.customize-control-toggle label .customize-control-title {
|
||||
width: calc(100% - 55px);
|
||||
}
|
||||
.customize-control-toggle label .description {
|
||||
order: 99;
|
||||
}
|
||||
.customize-control-toggle input[type="checkbox"] {
|
||||
display: none;
|
||||
}
|
||||
.customize-control-toggle .switch {
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
display: inline-block;
|
||||
width: 35px;
|
||||
height: 12px;
|
||||
border-radius: 8px;
|
||||
background: #ccc;
|
||||
vertical-align: middle;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
transition: background 350ms ease;
|
||||
}
|
||||
.customize-control-toggle .switch:before, .customize-control-toggle .switch:after {
|
||||
content: "";
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: -3px;
|
||||
transition: all 350ms cubic-bezier(0, 0.95, 0.38, 0.98), background 150ms ease;
|
||||
}
|
||||
.customize-control-toggle .switch:before {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
transform: translate3d(0, -50%, 0) scale(0);
|
||||
}
|
||||
.customize-control-toggle .switch:after {
|
||||
background: #999;
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
transform: translate3d(0, -50%, 0);
|
||||
}
|
||||
.customize-control-toggle .switch:active:before {
|
||||
transform: translate3d(0, -50%, 0) scale(3);
|
||||
}
|
||||
.customize-control-toggle input:checked + .switch {
|
||||
background: rgba(52, 152, 222, 0.3);
|
||||
}
|
||||
.customize-control-toggle input:checked + .switch:before {
|
||||
background: rgba(52, 152, 222, 0.075);
|
||||
transform: translate3d(100%, -50%, 0) scale(1);
|
||||
}
|
||||
.customize-control-toggle input:checked + .switch:after {
|
||||
background: #3498DE;
|
||||
transform: translate3d(100%, -50%, 0);
|
||||
}
|
||||
.customize-control-toggle input:checked + .switch:active:before {
|
||||
background: rgba(52, 152, 222, 0.075);
|
||||
transform: translate3d(100%, -50%, 0) scale(3);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
wp.customize.controlConstructor['toggle'] = wp.customize.Control.extend({
|
||||
|
||||
ready: function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
var control = this,
|
||||
checkboxValue = control.setting._value;
|
||||
|
||||
// Save the value
|
||||
this.container.on( 'change', 'input', function() {
|
||||
checkboxValue = ( jQuery( this ).is( ':checked' ) ) ? true : false;
|
||||
control.setting.set( checkboxValue );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
|
||||
/* Default Post Detail Author*/
|
||||
function zeitfresser_get_default_post_detail_author() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Detail Category*/
|
||||
function zeitfresser_get_default_post_detail_category() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Detail Comment*/
|
||||
function zeitfresser_get_default_post_detail_comment() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Default Post Detail Date*/
|
||||
function zeitfresser_get_default_post_detail_date() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Default Post Detail Featured Image*/
|
||||
function zeitfresser_get_default_post_detail_featured_image() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Detail Tag*/
|
||||
function zeitfresser_get_default_post_detail_featured_image_size() {
|
||||
return esc_html__( 'large', 'zeitfresser' );
|
||||
}
|
||||
|
||||
/* Default Post Detail Tag*/
|
||||
function zeitfresser_get_default_post_detail_tag() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Detail Social Share */
|
||||
function zeitfresser_get_default_post_detail_social_share() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Detail Social Share Options*/
|
||||
function zeitfresser_get_default_post_detail_social_share_options() {
|
||||
return array();
|
||||
}
|
||||
|
||||
/* Default Post Detail Author Block Options */
|
||||
function zeitfresser_get_default_post_detail_author_block() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Detail Related Articles Options*/
|
||||
function zeitfresser_get_default_post_detail_related_articles() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Default Post Detail Related Articles Title */
|
||||
function zeitfresser_get_default_post_detail_related_articles_title() {
|
||||
return esc_html__( "Related Articles", 'zeitfresser' );
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Post detail defaults only.
|
||||
*
|
||||
* The frontend still uses these defaults, but the related controls are intentionally
|
||||
* hidden to keep the customizer lean for the Zeitfresser setup.
|
||||
*/
|
||||
|
||||
require dirname( __FILE__ ) . '/default-post-detail.php';
|
||||
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
|
||||
/* Default Post Snippet Author*/
|
||||
function zeitfresser_get_default_post_snippet_author() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Snippet Category*/
|
||||
function zeitfresser_get_default_post_snippet_category() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Snippet Comment*/
|
||||
function zeitfresser_get_default_post_snippet_comment() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Snippet Date*/
|
||||
function zeitfresser_get_default_post_snippet_date() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Snippet Featured Image*/
|
||||
function zeitfresser_get_default_post_snippet_featured_image() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Default Post Snippet Tag*/
|
||||
function zeitfresser_get_default_post_snippet_featured_image_size() {
|
||||
return esc_html__( 'thumbnail', 'zeitfresser' );
|
||||
}
|
||||
|
||||
/* Default Post Snippet Tag*/
|
||||
function zeitfresser_get_default_post_snippet_tag() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Snippet Excerpt Szie */
|
||||
function zeitfresser_get_default_post_snippet_excerpt_size() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
/* Default Post Snippet Read More */
|
||||
function zeitfresser_get_default_post_snippet_show_hide_read_more() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Snippet Read More Text */
|
||||
function zeitfresser_get_default_post_snippet_read_more_text() {
|
||||
return esc_html__( "Read More", 'zeitfresser' );
|
||||
}
|
||||
|
||||
/* Default Post Snippet Social Share */
|
||||
function zeitfresser_get_default_post_snippet_social_share() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Default Post Snippet Social Share Options*/
|
||||
function zeitfresser_get_default_post_snippet_social_share_options() {
|
||||
return array();
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_post_snippet_excerpt_size' );
|
||||
function zeitfresser_post_snippet_excerpt_size( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_setting( 'post_snippet_excerpt_size', array(
|
||||
'sanitize_callback' => 'absint',
|
||||
'default' => zeitfresser_get_default_post_snippet_excerpt_size()
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( 'post_snippet_excerpt_size', array(
|
||||
'settings' => 'post_snippet_excerpt_size',
|
||||
'type' => 'number',
|
||||
'section' => 'daisy_blog_general_customization_section',
|
||||
'label' => esc_html__( 'Excerpt Size', 'zeitfresser' ),
|
||||
'priority' => 11,
|
||||
'input_attrs' => array(
|
||||
'min' => 5,
|
||||
'max' => 80,
|
||||
),
|
||||
) );
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Post snippet customizer section.
|
||||
*/
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_register_post_snippet_customization_section' );
|
||||
|
||||
/**
|
||||
* Register the post snippet section.
|
||||
*
|
||||
* @param WP_Customize_Manager $wp_customize Customizer manager.
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_register_post_snippet_customization_section( $wp_customize ) {
|
||||
$wp_customize->add_section(
|
||||
'daisy_blog_post_snippet_customization_section',
|
||||
array(
|
||||
'title' => esc_html__( 'Post Snippet', 'zeitfresser' ),
|
||||
'priority' => 22,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
require dirname( __FILE__ ) . '/default-post-snippet.php';
|
||||
require dirname( __FILE__ ) . '/excerpt/excerpt.php';
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
/* Default Site Title Show Hide Option */
|
||||
function zeitfresser_get_default_site_title_show_hide() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Default Site Tagline Show Hide Option */
|
||||
function zeitfresser_get_default_site_tagline_show_hide() {
|
||||
return true;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
/* Default Site Identity Settings */
|
||||
require dirname( __FILE__ ) . '/default-site-identity.php';
|
||||
|
||||
|
||||
require dirname( __FILE__ ) . '/site-title/site-title.php';
|
||||
|
||||
require dirname( __FILE__ ) . '/site-tagline/site-tagline.php';
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_show_hide_site_tagline' );
|
||||
function zeitfresser_show_hide_site_tagline( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_setting( 'show_hide_site_tagline', array(
|
||||
'sanitize_callback' => 'zeitfresser_sanitize_checkbox',
|
||||
'default' => zeitfresser_get_default_site_tagline_show_hide()
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( new Graphthemes_Toggle_Control( $wp_customize, 'show_hide_site_tagline', array(
|
||||
'label' => esc_html__( 'Show/Hide Site Tagline','zeitfresser' ),
|
||||
'section' => 'title_tagline',
|
||||
'settings' => 'show_hide_site_tagline',
|
||||
'type'=> 'toggle',
|
||||
) ) );
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_show_hide_site_title' );
|
||||
function zeitfresser_show_hide_site_title( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_setting( 'show_hide_site_title', array(
|
||||
'sanitize_callback' => 'zeitfresser_sanitize_checkbox',
|
||||
'default' => zeitfresser_get_default_site_title_show_hide(),
|
||||
) );
|
||||
|
||||
$wp_customize->add_control( new Graphthemes_Toggle_Control( $wp_customize, 'show_hide_site_title', array(
|
||||
'label' => esc_html__( 'Show/Hide Site Title','zeitfresser' ),
|
||||
'section' => 'title_tagline',
|
||||
'settings' => 'show_hide_site_title',
|
||||
'type'=> 'toggle',
|
||||
) ) );
|
||||
|
||||
}
|
||||
@@ -1,18 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* daisy blog Theme Customizer
|
||||
* Theme Customizer Core
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add postMessage support for site title and description for the Theme Customizer.
|
||||
*
|
||||
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_customize_register( $wp_customize ) {
|
||||
|
||||
// Live Preview support
|
||||
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
|
||||
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
|
||||
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
|
||||
@@ -36,7 +31,7 @@ function zeitfresser_customize_register( $wp_customize ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Performance Tools section
|
||||
* Performance Tools Section
|
||||
*/
|
||||
$wp_customize->add_section(
|
||||
'ztfr_performance_tools',
|
||||
@@ -47,7 +42,7 @@ function zeitfresser_customize_register( $wp_customize ) {
|
||||
);
|
||||
|
||||
/**
|
||||
* Auto optimize uploaded images.
|
||||
* Auto Optimize
|
||||
*/
|
||||
$wp_customize->add_setting(
|
||||
'ztfr_auto_optimize',
|
||||
@@ -63,12 +58,12 @@ function zeitfresser_customize_register( $wp_customize ) {
|
||||
'type' => 'checkbox',
|
||||
'section' => 'ztfr_performance_tools',
|
||||
'label' => 'Auto Optimize Pictures on Upload',
|
||||
'description' => 'Automatically converts uploaded images to modern formats (AVIF/WebP) for improved performance.',
|
||||
'description' => 'Automatically converts images to AVIF/WebP.',
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Auto delete originals after successful optimization.
|
||||
* Auto Delete
|
||||
*/
|
||||
$wp_customize->add_setting(
|
||||
'ztfr_auto_delete',
|
||||
@@ -83,35 +78,26 @@ function zeitfresser_customize_register( $wp_customize ) {
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'section' => 'ztfr_performance_tools',
|
||||
'label' => 'Auto Delete Original Pictures on Upload',
|
||||
'description' => 'Automatically deletes original images after optimization.',
|
||||
'label' => 'Auto Delete Original Pictures',
|
||||
'description' => 'Deletes originals after optimization.',
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'customize_register', 'zeitfresser_customize_register' );
|
||||
|
||||
/**
|
||||
* Render the site title for the selective refresh partial.
|
||||
*
|
||||
* @return void
|
||||
* Partial refresh helpers
|
||||
*/
|
||||
function zeitfresser_customize_partial_blogname() {
|
||||
bloginfo( 'name' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the site tagline for the selective refresh partial.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_customize_partial_blogdescription() {
|
||||
bloginfo( 'description' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind JS handlers to make Theme Customizer preview reload changes asynchronously.
|
||||
*
|
||||
* @return void
|
||||
* Live preview JS
|
||||
*/
|
||||
function zeitfresser_customize_preview_js() {
|
||||
wp_enqueue_script(
|
||||
@@ -125,20 +111,19 @@ function zeitfresser_customize_preview_js() {
|
||||
add_action( 'customize_preview_init', 'zeitfresser_customize_preview_js' );
|
||||
|
||||
/**
|
||||
* Add dependency logic and status box for Performance Tools settings.
|
||||
*
|
||||
* @return void
|
||||
* Dependency UI logic
|
||||
*/
|
||||
function zeitfresser_customize_controls_dependency_js() {
|
||||
?>
|
||||
<script>
|
||||
(function() {
|
||||
|
||||
function getOptimizeInput() {
|
||||
return document.querySelector('#customize-control-ztfr_auto_optimize input[type="checkbox"]');
|
||||
return document.querySelector('#customize-control-ztfr_auto_optimize input');
|
||||
}
|
||||
|
||||
function getDeleteInput() {
|
||||
return document.querySelector('#customize-control-ztfr_auto_delete input[type="checkbox"]');
|
||||
return document.querySelector('#customize-control-ztfr_auto_delete input');
|
||||
}
|
||||
|
||||
function getDeleteControl() {
|
||||
@@ -146,17 +131,14 @@ function zeitfresser_customize_controls_dependency_js() {
|
||||
}
|
||||
|
||||
function ensureStatusBox() {
|
||||
|
||||
let box = document.getElementById('ztfr-auto-status-box');
|
||||
|
||||
if (box) {
|
||||
return box;
|
||||
}
|
||||
if (box) return box;
|
||||
|
||||
const optimizeControl = document.getElementById('customize-control-ztfr_auto_optimize');
|
||||
|
||||
if (!optimizeControl || !optimizeControl.parentNode) {
|
||||
return null;
|
||||
}
|
||||
if (!optimizeControl || !optimizeControl.parentNode) return null;
|
||||
|
||||
box = document.createElement('li');
|
||||
box.id = 'ztfr-auto-status-box';
|
||||
@@ -199,66 +181,64 @@ function zeitfresser_customize_controls_dependency_js() {
|
||||
}
|
||||
|
||||
function init() {
|
||||
updateState();
|
||||
|
||||
document.addEventListener('change', function(event) {
|
||||
const target = event.target;
|
||||
let attempts = 0;
|
||||
|
||||
if (
|
||||
target &&
|
||||
(
|
||||
target.matches('#customize-control-ztfr_auto_optimize input[type="checkbox"]') ||
|
||||
target.matches('#customize-control-ztfr_auto_delete input[type="checkbox"]')
|
||||
)
|
||||
) {
|
||||
updateState();
|
||||
}
|
||||
});
|
||||
function tryInit() {
|
||||
const optimize = getOptimizeInput();
|
||||
const del = getDeleteInput();
|
||||
|
||||
let tries = 0;
|
||||
const interval = setInterval(function() {
|
||||
updateState();
|
||||
tries++;
|
||||
if (optimize && del) {
|
||||
updateState();
|
||||
return;
|
||||
}
|
||||
|
||||
if (tries > 20) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
// Retry max 10x
|
||||
if (attempts < 10) {
|
||||
attempts++;
|
||||
setTimeout(tryInit, 200);
|
||||
}
|
||||
}
|
||||
|
||||
tryInit();
|
||||
|
||||
document.addEventListener('change', function(e) {
|
||||
if (
|
||||
e.target &&
|
||||
(
|
||||
e.target.matches('#customize-control-ztfr_auto_optimize input') ||
|
||||
e.target.matches('#customize-control-ztfr_auto_delete input')
|
||||
)
|
||||
) {
|
||||
updateState();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
|
||||
})();
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
add_action( 'customize_controls_enqueue_scripts', 'zeitfresser_customize_controls_dependency_js' );
|
||||
|
||||
/**
|
||||
* Small UI polish
|
||||
*/
|
||||
add_action( 'customize_controls_enqueue_scripts', function() {
|
||||
?>
|
||||
<style>
|
||||
/* 🔥 Settings Label Bolt */
|
||||
#customize-control-ztfr_auto_optimize label,
|
||||
#customize-control-ztfr_auto_delete label {
|
||||
font-weight: 600;
|
||||
display: block;
|
||||
margin-bottom: 2px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
/* 🔥 Warning line under description */
|
||||
#customize-control-ztfr_auto_delete .description::after {
|
||||
content: "⚠ This action cannot be undone.";
|
||||
display: block;
|
||||
margin-top: 6px;
|
||||
color: #b32d2e;
|
||||
font-weight: 500;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
?>
|
||||
<style>
|
||||
#customize-control-ztfr_auto_optimize > label,
|
||||
#customize-control-ztfr_auto_delete > label {
|
||||
display:flex;
|
||||
align-items:flex-start;
|
||||
gap:6px;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/**
|
||||
* General Theme Options
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_general_options' );
|
||||
|
||||
function zeitfresser_general_options( $wp_customize ) {
|
||||
|
||||
/**
|
||||
* General Section (falls nicht schon vorhanden)
|
||||
*/
|
||||
if ( ! $wp_customize->get_section( 'ztfr_general' ) ) {
|
||||
$wp_customize->add_section(
|
||||
'ztfr_general',
|
||||
array(
|
||||
'title' => 'General Options',
|
||||
'priority' => 30,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Excerpt Length
|
||||
*/
|
||||
$wp_customize->add_setting(
|
||||
'post_snippet_excerpt_size',
|
||||
array(
|
||||
'default' => 20,
|
||||
'sanitize_callback' => 'absint',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'post_snippet_excerpt_size',
|
||||
array(
|
||||
'type' => 'number',
|
||||
'section' => 'ztfr_general',
|
||||
'label' => 'Excerpt Length (Post Cards)',
|
||||
'description' => 'Number of words shown in post previews.',
|
||||
'input_attrs' => array(
|
||||
'min' => 5,
|
||||
'max' => 100,
|
||||
'step' => 1,
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Show Site Title
|
||||
*/
|
||||
$wp_customize->add_setting(
|
||||
'show_hide_site_title',
|
||||
array(
|
||||
'default' => true,
|
||||
'sanitize_callback' => 'wp_validate_boolean',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'show_hide_site_title',
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'section' => 'ztfr_general',
|
||||
'label' => 'Show Site Title',
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Show Tagline
|
||||
*/
|
||||
$wp_customize->add_setting(
|
||||
'show_hide_site_tagline',
|
||||
array(
|
||||
'default' => true,
|
||||
'sanitize_callback' => 'wp_validate_boolean',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'show_hide_site_tagline',
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'section' => 'ztfr_general',
|
||||
'label' => 'Show Tagline',
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Layout / Container Settings
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_layout_options' );
|
||||
|
||||
function zeitfresser_layout_options( $wp_customize ) {
|
||||
|
||||
/**
|
||||
* Container Width
|
||||
*/
|
||||
$wp_customize->add_setting(
|
||||
'container_width',
|
||||
array(
|
||||
'default' => 1400,
|
||||
'sanitize_callback' => 'absint',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'container_width',
|
||||
array(
|
||||
'type' => 'number',
|
||||
'section' => 'ztfr_general',
|
||||
'label' => esc_html__( 'Container Width', 'zeitfresser' ),
|
||||
'description' => esc_html__( 'Maximum width of the content container in pixels.', 'zeitfresser' ),
|
||||
'priority' => 10,
|
||||
'input_attrs' => array(
|
||||
'min' => 800,
|
||||
'max' => 2000,
|
||||
'step' => 10,
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply container width via CSS variable
|
||||
*/
|
||||
add_action( 'wp_head', 'zeitfresser_container_width_dynamic_css' );
|
||||
|
||||
function zeitfresser_container_width_dynamic_css() {
|
||||
|
||||
$container_width = (int) get_theme_mod( 'container_width' );
|
||||
|
||||
if ( $container_width <= 0 ) {
|
||||
$container_width = 1140;
|
||||
}
|
||||
|
||||
echo '<style>:root{--container-width:' . esc_attr( $container_width ) . 'px;}</style>';
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* Social links customizer settings.
|
||||
* Social Links Customizer Options
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'zeitfresser_get_social_links' ) ) {
|
||||
/**
|
||||
* Return supported social network labels.
|
||||
* Return supported social networks.
|
||||
*
|
||||
* @return array<string,string>
|
||||
*/
|
||||
@@ -15,7 +15,7 @@ if ( ! function_exists( 'zeitfresser_get_social_links' ) ) {
|
||||
return array(
|
||||
'facebook' => esc_html__( 'Facebook', 'zeitfresser' ),
|
||||
'instagram' => esc_html__( 'Instagram', 'zeitfresser' ),
|
||||
'youtube' => esc_html__( 'Youtube', 'zeitfresser' ),
|
||||
'youtube' => esc_html__( 'YouTube', 'zeitfresser' ),
|
||||
'linkedin' => esc_html__( 'LinkedIn', 'zeitfresser' ),
|
||||
'twitter' => esc_html__( 'Twitter', 'zeitfresser' ),
|
||||
'pinterest' => esc_html__( 'Pinterest', 'zeitfresser' ),
|
||||
@@ -29,54 +29,52 @@ if ( ! function_exists( 'zeitfresser_get_social_links' ) ) {
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_social_links' );
|
||||
|
||||
/**
|
||||
* Register social link customizer controls.
|
||||
*
|
||||
* @param WP_Customize_Manager $wp_customize Customizer manager.
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_social_links( $wp_customize ) {
|
||||
$social_links = zeitfresser_get_social_links();
|
||||
$social_links_title = '<hr/><h2>' . esc_html__( 'Social Links:', 'zeitfresser' ) . '</h2>';
|
||||
|
||||
$social_links = zeitfresser_get_social_links();
|
||||
|
||||
/**
|
||||
* Section Divider
|
||||
*/
|
||||
$wp_customize->add_setting(
|
||||
'social_links_title',
|
||||
'ztfr_social_heading',
|
||||
array(
|
||||
'default' => '',
|
||||
'sanitize_callback' => 'wp_kses_post',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Daisy_Blog_Custom_Text(
|
||||
$wp_customize,
|
||||
'social_links_title',
|
||||
array(
|
||||
'section' => 'daisy_blog_general_customization_section',
|
||||
'label' => $social_links_title,
|
||||
'priority' => 20,
|
||||
)
|
||||
'ztfr_social_heading',
|
||||
array(
|
||||
'section' => 'ztfr_general',
|
||||
'type' => 'hidden',
|
||||
'description' => '<hr><strong>' . esc_html__( 'Social Links', 'zeitfresser' ) . '</strong>',
|
||||
'priority' => 30,
|
||||
)
|
||||
);
|
||||
|
||||
$social_priority = 21;
|
||||
/**
|
||||
* Social URLs
|
||||
*/
|
||||
$priority = 31;
|
||||
|
||||
foreach ( $social_links as $key => $label ) {
|
||||
|
||||
foreach ( $social_links as $social_key => $social_label ) {
|
||||
$wp_customize->add_setting(
|
||||
'social_links_' . $social_key,
|
||||
'social_links_' . $key,
|
||||
array(
|
||||
'default' => zeitfresser_get_social_link_default( $social_key ),
|
||||
'default' => '',
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'social_links_' . $social_key,
|
||||
'social_links_' . $key,
|
||||
array(
|
||||
'label' => $social_label,
|
||||
'section' => 'daisy_blog_general_customization_section',
|
||||
'type' => 'url',
|
||||
'priority' => $social_priority++,
|
||||
'section' => 'ztfr_general',
|
||||
'label' => $label,
|
||||
'priority' => $priority++,
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* TOC Customizer Options
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
add_action( 'customize_register', 'zeitfresser_toc_options' );
|
||||
|
||||
function zeitfresser_toc_options( $wp_customize ) {
|
||||
|
||||
/**
|
||||
* Section Divider (UI only)
|
||||
*/
|
||||
$wp_customize->add_setting(
|
||||
'ztfr_toc_heading',
|
||||
array(
|
||||
'sanitize_callback' => 'wp_kses_post',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'ztfr_toc_heading',
|
||||
array(
|
||||
'section' => 'ztfr_general',
|
||||
'type' => 'hidden',
|
||||
'description' => '<hr><strong>' . esc_html__( 'Article TOC', 'zeitfresser' ) . '</strong>',
|
||||
'priority' => 20,
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Toggle TOC
|
||||
*/
|
||||
$wp_customize->add_setting(
|
||||
'show_article_toc',
|
||||
array(
|
||||
'default' => true,
|
||||
'sanitize_callback' => 'wp_validate_boolean',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'show_article_toc',
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'section' => 'ztfr_general',
|
||||
'label' => esc_html__( 'Show Article TOC', 'zeitfresser' ),
|
||||
'description' => esc_html__( 'Enable floating TOC on single posts.', 'zeitfresser' ),
|
||||
'priority' => 21,
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Minimum headlines threshold
|
||||
*/
|
||||
$wp_customize->add_setting(
|
||||
'article_toc_min_headlines',
|
||||
array(
|
||||
'default' => 3,
|
||||
'sanitize_callback' => 'absint',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'article_toc_min_headlines',
|
||||
array(
|
||||
'type' => 'number',
|
||||
'section' => 'ztfr_general',
|
||||
'label' => esc_html__( 'Minimum Headlines for TOC', 'zeitfresser' ),
|
||||
'description' => esc_html__( 'TOC appears only if this number of headings is reached.', 'zeitfresser' ),
|
||||
'priority' => 22,
|
||||
'input_attrs' => array(
|
||||
'min' => 1,
|
||||
'max' => 50,
|
||||
'step' => 1,
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -9,6 +9,48 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the fixed thumbnail size used for post cards and snippets.
|
||||
*
|
||||
* This keeps thumbnail selection deterministic while still allowing
|
||||
* a single central code-level switch if the size ever needs to change.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
if ( ! function_exists( 'zeitfresser_get_post_card_thumbnail_size' ) ) {
|
||||
function zeitfresser_get_post_card_thumbnail_size() {
|
||||
return 'thumbnail';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether post card featured images should be displayed.
|
||||
*
|
||||
* This replaces the old Customizer-based toggle with a static,
|
||||
* deterministic decision.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
if ( ! function_exists( 'zeitfresser_show_post_card_featured_image' ) ) {
|
||||
function zeitfresser_show_post_card_featured_image() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the excerpt length for post cards.
|
||||
*
|
||||
* This remains configurable via Theme Customizer, as it is a
|
||||
* meaningful editorial control.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
if ( ! function_exists( 'zeitfresser_get_post_card_excerpt_length' ) ) {
|
||||
function zeitfresser_get_post_card_excerpt_length() {
|
||||
return (int) get_theme_mod( 'post_snippet_excerpt_size', 20 );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'zeitfresser_fs' ) ) {
|
||||
/**
|
||||
* Lightweight Freemius compatibility stub.
|
||||
@@ -121,9 +163,9 @@ if ( ! function_exists( 'zeitfresser_social_icon_svg' ) ) {
|
||||
'twitter' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" aria-hidden="true" focusable="false"><path d="M459.37 151.72c.32 4.54.32 9.1.32 13.63c0 138.72-105.58 298.56-298.56 298.56c-59.45 0-114.68-17.22-161.14-47.11c8.45 1 16.57 1.32 25.34 1.32c49.06 0 94.21-16.57 130.27-44.84c-46.13-1-84.79-31.24-98.11-72.77c6.5 1 12.99 1.63 19.81 1.63c9.42 0 18.84-1.32 27.61-3.57c-48.08-9.74-84.14-51.98-84.14-102.98v-1.32c13.97 7.8 30.21 12.67 47.43 13.3c-28.3-18.84-46.78-51.02-46.78-87.39c0-19.49 5.2-37.36 14.29-52.95c51.98 63.67 129.3 105.26 216.36 109.75c-1.62-7.8-2.6-15.92-2.6-24.04c0-57.83 46.78-104.93 104.93-104.93c30.21 0 57.5 12.67 76.67 33.14c23.72-4.55 46.46-13.3 66.59-25.34c-7.8 24.37-24.37 44.84-46.13 57.83c21.12-2.27 41.58-8.12 60.42-16.24c-14.29 20.79-32.16 39.31-52.63 54.25z"/></svg>',
|
||||
'pinterest' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" aria-hidden="true" focusable="false"><path d="M204 6.7C93.4 6.7 0 100.1 0 210.7c0 69.2 40.5 128.9 101.6 161.4c-1.4-13.7-2.6-34.8.5-49.8c2.8-15.9 18.1-101.2 18.1-101.2s-4.6-9.3-4.6-23c0-21.6 12.5-37.8 28.1-37.8c13.2 0 19.6 9.9 19.6 21.8c0 13.2-8.4 33-12.7 51.3c-3.6 15.6 7.7 28.4 23 28.4c27.6 0 48.9-29.1 48.9-71.1c0-37.2-26.8-63.2-65-63.2c-44.3 0-70.3 33.1-70.3 67.5c0 13.3 5.1 27.5 11.6 35.2c1.3 1.6 1.5 3 .9 4.7c-1 5.1-3.2 16-3.6 18.2c-.6 3-2.1 3.6-4.8 2.2c-17.8-8.3-28.9-34.1-28.9-54.8c0-44.6 32.4-85.6 93.4-85.6c49 0 87.1 34.9 87.1 81.6c0 48.7-30.7 87.9-73.2 87.9c-14.3 0-27.7-7.4-32.3-16.2l-8.8 33.5c-3.2 12.2-11.8 27.5-17.6 36.8c13.2 4.1 27.1 6.2 41.5 6.2c110.6 0 204-93.4 204-204S314.6 6.7 204 6.7z"/></svg>',
|
||||
'tiktok' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" aria-hidden="true" focusable="false"><path d="M448,209.9a210.06,210.06,0,0,1-122.77-39.25V349.38A162.55,162.55,0,1,1,185,188.31V278.2a74.62,74.62,0,1,0,52.23,71.18V0h88a121.18,121.18,0,0,0,1.86,22.17h0A122.18,122.18,0,0,0,448,142.3Z"/></svg>',
|
||||
'mastodon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" aria-hidden="true" focusable="false"><path d="M433 179.11c0-97.2-63.91-125.7-63.91-125.7C336.42 38.4 279.2 32 224.14 32h-.27c-55.06 0-112.28 6.4-144.95 21.41c0 0-63.92 28.5-63.92 125.7c0 22.34-.43 49.13.27 81.78c2.31 109.32 20.05 217.01 121.08 241.82c46.64 11.45 86.68 13.84 119.46 12.06c59.08-3.2 92.27-20.62 92.27-20.62l-1.96-43.47s-42.3 13.33-89.78 11.72c-47.03-1.6-96.73-5.09-104.41-63.16a116.85 116.85 0 0 1-1.06-15.65s46.27 11.3 104.92 13.99c35.27 1.62 68.32-2.06 101.96-6.15c64.49-7.83 120.53-48.23 127.62-85.36c11.18-58.65 10.26-143.5 10.26-143.5zm-80.32 145.27h-50.54V200.59c0-26.15-11.06-39.43-33.17-39.43c-24.46 0-36.72 15.84-36.72 47.1v67.82H181.8V208.26c0-31.26-12.26-47.1-36.73-47.1c-22.1 0-33.16 13.28-33.16 39.43v123.79H61.37V196.83c0-26.15 6.68-46.92 20.03-62.31c13.75-15.39 31.75-23.14 54.09-23.14c25.82 0 45.34 9.92 58.74 29.76l12.69 21.11l12.69-21.11c13.4-19.84 32.92-29.76 58.75-29.76c22.33 0 40.34 7.75 54.08 23.14c13.36 15.39 20.04 36.16 20.04 62.31z"/></svg>',
|
||||
'github' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512" aria-hidden="true" focusable="false"><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6c-3.3.3-5.6-1.3-5.6-3.6c0-2 2.3-3.6 5.2-3.6c3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9c2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9c.3 2 2.6 3.3 5.6 2.6c2.9-.7 4.9-2.6 4.6-4.6c-.3-2.3-2.6-3.6-5.6-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 71.8 205 171.6 238.2c12.8 2.3 17.5-5.6 17.5-12.1c0-6.2-.3-40.4-.3-61.4c0 0-70 15-84.7-29.8c0 0-11.4-29.1-27.8-36.9c0 0-22.9-15.7 1.6-15.4c0 0 24.9 2 38.6 25.8c21.9 38.6 58.6 27.5 72.9 20.9c2.3-16 8.8-27.5 16-33.7c-55.9-6.2-112.3-13.9-112.3-110.5c0-27.5 7.8-41.4 20.6-55.2c-2-5-8.8-25.7 2-53.6c16.1-5 52.6 20.6 52.6 20.6c15.2-4.3 31.4-6.5 47.6-6.5c16.3 0 32.8 2.3 47.7 6.5c0 0 36.6-25.8 52.6-20.6c10.8 27.8 4 48.6 2 53.6c12.8 13.8 20.6 27.8 20.6 55.2c0 96.9-58.8 104.2-114.9 110.5c9.2 7.8 17.2 22.9 17.2 46.4c0 33.7-.3 75.4-.3 83.1c0 6.5 4.6 14.4 17.5 12.1C424.2 457 496 362.9 496 252C496 113.3 383.5 8 244.8 8z"/></svg>',
|
||||
'matrix' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512" aria-hidden="true" focusable="false"><path d="M0 32v448h60V0H0v32zm580 0v448h60V0h-60v32zM120 96v320h70V206.8l77.7 117.8h4.6L350 206.8V416h70V96h-68l-81.4 122.6L189 96h-69z"/></svg>',
|
||||
'mastodon' => '<svg viewBox="0 0 448 512" aria-hidden="true"><path d="M433 179.11c0-97.2-63.91-125.7-63.91-125.7C336.42 38.4 279.2 32 224.14 32h-.27c-55.06 0-112.28 6.4-144.95 21.41c0 0-63.92 28.5-63.92 125.7c0 22.34-.43 49.13.27 81.78c2.31 109.32 20.05 217.01 121.08 241.82c46.64 11.45 86.68 13.84 119.46 12.06c59.08-3.2 92.27-20.62 92.27-20.62l-1.96-43.47s-42.3 13.33-89.78 11.72c-47.03-1.6-96.73-5.09-104.41-63.16a116.85 116.85 0 0 1-1.06-15.65s46.27 11.3 104.92 13.99c35.27 1.62 68.32-2.06 101.96-6.15c64.49-7.83 120.53-48.23 127.62-85.36c11.18-58.65 10.26-143.5 10.26-143.5zm-80.32 145.27h-50.54V200.59c0-26.15-11.06-39.43-33.17-39.43c-24.46 0-36.72 15.84-36.72 47.1v67.82H181.8V208.26c0-31.26-12.26-47.1-36.73-47.1c-22.1 0-33.16 13.28-33.16 39.43v123.79H61.37V196.83c0-26.15 6.68-46.92 20.03-62.31c13.75-15.39 31.75-23.14 54.09-23.14c25.82 0 45.34 9.92 58.74 29.76l12.69 21.11l12.69-21.11c13.4-19.84 32.92-29.76 58.75-29.76c22.33 0 40.34 7.75 54.08 23.14c13.36 15.39 20.04 36.16 20.04 62.31z"/></svg>',
|
||||
'github' => '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 .297a12 12 0 0 0-3.794 23.403c.6.113.82-.26.82-.577v-2.234c-3.338.726-4.042-1.61-4.042-1.61a3.18 3.18 0 0 0-1.335-1.754c-1.09-.745.083-.73.083-.73a2.52 2.52 0 0 1 1.84 1.24 2.555 2.555 0 0 0 3.49.997 2.56 2.56 0 0 1 .763-1.606c-2.665-.303-5.466-1.334-5.466-5.933a4.64 4.64 0 0 1 1.235-3.216 4.31 4.31 0 0 1 .117-3.172s1.008-.322 3.301 1.23a11.46 11.46 0 0 1 6.003 0c2.293-1.552 3.3-1.23 3.3-1.23a4.31 4.31 0 0 1 .118 3.172 4.64 4.64 0 0 1 1.234 3.216c0 4.61-2.804 5.627-5.476 5.922a2.865 2.865 0 0 1 .815 2.222v3.293c0 .32.218.694.825.576A12.001 12.001 0 0 0 12 .297"/></svg>',
|
||||
'matrix' => '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M2 2v20h3V5.5l5 7.5h1l5-7.5V22h3V2h-3l-5.5 8-5.5-8H2z"/></svg>',
|
||||
);
|
||||
|
||||
return isset( $icons[ $key ] ) ? $icons[ $key ] : '';
|
||||
@@ -150,3 +192,35 @@ function db_fs() {
|
||||
function graphthemes_get_social_link_default( $social_key ) {
|
||||
return zeitfresser_get_social_link_default( $social_key );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get asset URL with version (cache busting).
|
||||
*
|
||||
* @param string $path Relative path inside /assets (must start with /)
|
||||
* @return array{url:string, version:string}
|
||||
*/
|
||||
if ( ! function_exists( 'zeitfresser_asset_versioned' ) ) {
|
||||
function zeitfresser_asset_versioned( $path ) {
|
||||
|
||||
$full_path = '/assets' . $path;
|
||||
|
||||
return [
|
||||
'url' => get_template_directory_uri() . $full_path,
|
||||
'version' => file_exists( get_template_directory() . $full_path )
|
||||
? (string) filemtime( get_template_directory() . $full_path )
|
||||
: ZEITFRESSER_VERSION,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get asset URL only (no version).
|
||||
*
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
if ( ! function_exists( 'zeitfresser_asset' ) ) {
|
||||
function zeitfresser_asset( $path ) {
|
||||
return get_template_directory_uri() . '/assets/' . ltrim($path, '/');
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Jetpack Compatibility File
|
||||
*
|
||||
* @link https://jetpack.com/
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
/**
|
||||
* Jetpack setup function.
|
||||
*
|
||||
* See: https://jetpack.com/support/infinite-scroll/
|
||||
* See: https://jetpack.com/support/responsive-videos/
|
||||
* See: https://jetpack.com/support/content-options/
|
||||
*/
|
||||
function zeitfresser_jetpack_setup() {
|
||||
// Add theme support for Infinite Scroll.
|
||||
add_theme_support(
|
||||
'infinite-scroll',
|
||||
array(
|
||||
'container' => 'main',
|
||||
'render' => 'zeitfresser_infinite_scroll_render',
|
||||
'footer' => 'page',
|
||||
)
|
||||
);
|
||||
|
||||
// Add theme support for Responsive Videos.
|
||||
add_theme_support( 'jetpack-responsive-videos' );
|
||||
|
||||
// Add theme support for Content Options.
|
||||
add_theme_support(
|
||||
'jetpack-content-options',
|
||||
array(
|
||||
'post-details' => array(
|
||||
'stylesheet' => 'zeitfresser',
|
||||
'date' => '.posted-on',
|
||||
'categories' => '.cat-links',
|
||||
'tags' => '.tags-links',
|
||||
'author' => '.byline',
|
||||
'comment' => '.comments-link',
|
||||
),
|
||||
'featured-images' => array(
|
||||
'archive' => true,
|
||||
'post' => true,
|
||||
'page' => true,
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
add_action( 'after_setup_theme', 'zeitfresser_jetpack_setup' );
|
||||
|
||||
if ( ! function_exists( 'zeitfresser_infinite_scroll_render' ) ) :
|
||||
/**
|
||||
* Custom render function for Infinite Scroll.
|
||||
*/
|
||||
function zeitfresser_infinite_scroll_render() {
|
||||
while ( have_posts() ) {
|
||||
the_post();
|
||||
if ( is_search() ) :
|
||||
get_template_part( 'template-parts/content', 'search' );
|
||||
else :
|
||||
get_template_part( 'template-parts/content', get_post_type() );
|
||||
endif;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
@@ -171,19 +171,25 @@ function zeitfresser_get_original_family_files( $attachment_id, $original ) {
|
||||
}
|
||||
|
||||
$original_ext = strtolower( pathinfo( $original, PATHINFO_EXTENSION ) );
|
||||
$base_name = pathinfo( $original, PATHINFO_FILENAME );
|
||||
$dir = dirname( $original );
|
||||
|
||||
if ( empty( $original_ext ) ) {
|
||||
return $files;
|
||||
}
|
||||
|
||||
// Original
|
||||
$files[] = $original;
|
||||
|
||||
// --- ORIGINAL LOGIC (metadata-based) ---
|
||||
$metadata = wp_get_attachment_metadata( $attachment_id );
|
||||
$upload_dir = wp_get_upload_dir();
|
||||
|
||||
if ( ! empty( $metadata['file'] ) ) {
|
||||
|
||||
$current_main_absolute = trailingslashit( $upload_dir['basedir'] ) . $metadata['file'];
|
||||
|
||||
// scaled/main
|
||||
$files[] = preg_replace(
|
||||
'/\.[^.]+$/',
|
||||
'.' . $original_ext,
|
||||
@@ -207,9 +213,12 @@ function zeitfresser_get_original_family_files( $attachment_id, $original ) {
|
||||
}
|
||||
}
|
||||
|
||||
$files = array_unique( array_filter( $files ) );
|
||||
// --- NEW: FILESYSTEM FALLBACK (CRITICAL FIX) ---
|
||||
foreach ( glob( $dir . '/' . $base_name . '*.' . $original_ext ) as $file ) {
|
||||
$files[] = $file;
|
||||
}
|
||||
|
||||
return array_values( $files );
|
||||
return array_values( array_unique( array_filter( $files ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
+21
-25
@@ -15,7 +15,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
* @return bool
|
||||
*/
|
||||
function zeitfresser_show_article_toc() {
|
||||
return (bool) get_theme_mod( 'show_article_toc', zeitfresser_get_default_show_article_toc() );
|
||||
return (bool) get_theme_mod( 'show_article_toc', true );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,11 +24,10 @@ function zeitfresser_show_article_toc() {
|
||||
* @return int
|
||||
*/
|
||||
function zeitfresser_get_article_toc_min_headlines() {
|
||||
$threshold = absint( get_theme_mod( 'article_toc_min_headlines', zeitfresser_get_default_article_toc_min_headlines() ) );
|
||||
$threshold = absint( get_theme_mod( 'article_toc_min_headlines', 3 ) );
|
||||
return max( 1, $threshold );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build a processed single post content payload with TOC metadata.
|
||||
*
|
||||
@@ -36,8 +35,8 @@ function zeitfresser_get_article_toc_min_headlines() {
|
||||
* @return array{content:string,items:array<int,array<string,mixed>>}
|
||||
*/
|
||||
function zeitfresser_build_toc_payload( $post_id ) {
|
||||
static $cache = array();
|
||||
|
||||
static $cache = array();
|
||||
$post_id = (int) $post_id;
|
||||
|
||||
if ( isset( $cache[ $post_id ] ) ) {
|
||||
@@ -49,21 +48,15 @@ function zeitfresser_build_toc_payload( $post_id ) {
|
||||
'items' => array(),
|
||||
);
|
||||
|
||||
// Early exit conditions
|
||||
if ( ! $post_id || ! is_singular( 'post' ) || ! zeitfresser_show_article_toc() ) {
|
||||
$cache[ $post_id ] = $payload;
|
||||
return $payload;
|
||||
return $cache[ $post_id ] = $payload;
|
||||
}
|
||||
|
||||
$content = trim( (string) $payload['content'] );
|
||||
|
||||
if ( '' === $content ) {
|
||||
$cache[ $post_id ] = $payload;
|
||||
return $payload;
|
||||
}
|
||||
|
||||
if ( ! class_exists( 'DOMDocument' ) ) {
|
||||
$cache[ $post_id ] = $payload;
|
||||
return $payload;
|
||||
if ( '' === $content || ! class_exists( 'DOMDocument' ) ) {
|
||||
return $cache[ $post_id ] = $payload;
|
||||
}
|
||||
|
||||
libxml_use_internal_errors( true );
|
||||
@@ -76,16 +69,14 @@ function zeitfresser_build_toc_payload( $post_id ) {
|
||||
|
||||
if ( ! $loaded ) {
|
||||
libxml_clear_errors();
|
||||
$cache[ $post_id ] = $payload;
|
||||
return $payload;
|
||||
return $cache[ $post_id ] = $payload;
|
||||
}
|
||||
|
||||
$container = $dom->getElementById( 'zeitfresser-toc-root' );
|
||||
|
||||
if ( ! $container ) {
|
||||
libxml_clear_errors();
|
||||
$cache[ $post_id ] = $payload;
|
||||
return $payload;
|
||||
return $cache[ $post_id ] = $payload;
|
||||
}
|
||||
|
||||
$index = 1;
|
||||
@@ -95,8 +86,8 @@ function zeitfresser_build_toc_payload( $post_id ) {
|
||||
|
||||
if ( $headings instanceof DOMNodeList ) {
|
||||
foreach ( $headings as $heading ) {
|
||||
$text = trim( wp_strip_all_tags( $heading->textContent ) );
|
||||
|
||||
$text = trim( wp_strip_all_tags( $heading->textContent ) );
|
||||
if ( '' === $text ) {
|
||||
continue;
|
||||
}
|
||||
@@ -128,20 +119,18 @@ function zeitfresser_build_toc_payload( $post_id ) {
|
||||
|
||||
libxml_clear_errors();
|
||||
|
||||
// Respect minimum threshold
|
||||
if ( count( $toc_items ) < zeitfresser_get_article_toc_min_headlines() ) {
|
||||
$cache[ $post_id ] = array(
|
||||
return $cache[ $post_id ] = array(
|
||||
'content' => zeitfresser_extract_toc_inner_html( $container ),
|
||||
'items' => array(),
|
||||
);
|
||||
return $cache[ $post_id ];
|
||||
}
|
||||
|
||||
$cache[ $post_id ] = array(
|
||||
return $cache[ $post_id ] = array(
|
||||
'content' => zeitfresser_extract_toc_inner_html( $container ),
|
||||
'items' => $toc_items,
|
||||
);
|
||||
|
||||
return $cache[ $post_id ];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,6 +140,7 @@ function zeitfresser_build_toc_payload( $post_id ) {
|
||||
* @return string
|
||||
*/
|
||||
function zeitfresser_extract_toc_inner_html( $node ) {
|
||||
|
||||
$html = '';
|
||||
|
||||
if ( ! $node || ! $node->hasChildNodes() ) {
|
||||
@@ -171,6 +161,7 @@ function zeitfresser_extract_toc_inner_html( $node ) {
|
||||
* @return bool
|
||||
*/
|
||||
function zeitfresser_has_floating_toc( $post_id = null ) {
|
||||
|
||||
$post_id = $post_id ? (int) $post_id : get_the_ID();
|
||||
|
||||
if ( ! $post_id ) {
|
||||
@@ -189,6 +180,7 @@ function zeitfresser_has_floating_toc( $post_id = null ) {
|
||||
* @return void
|
||||
*/
|
||||
function zeitfresser_render_floating_toc( $post_id = null ) {
|
||||
|
||||
$post_id = $post_id ? (int) $post_id : get_the_ID();
|
||||
|
||||
if ( ! $post_id ) {
|
||||
@@ -201,13 +193,16 @@ function zeitfresser_render_floating_toc( $post_id = null ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
||||
<aside class="zeitfresser-floating-toc" id="zeitfresser-floating-toc" aria-label="<?php echo esc_attr__( 'Table of contents', 'zeitfresser' ); ?>">
|
||||
<div class="zeitfresser-floating-toc__header">
|
||||
<span class="zeitfresser-floating-toc__title"><?php echo esc_html__( 'Content', 'zeitfresser' ); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="zeitfresser-floating-toc__progress" aria-hidden="true">
|
||||
<span class="zeitfresser-floating-toc__progress-bar" id="zeitfresser-floating-toc-progress"></span>
|
||||
</div>
|
||||
|
||||
<nav class="zeitfresser-floating-toc__nav">
|
||||
<ol class="zeitfresser-floating-toc__list">
|
||||
<?php foreach ( $payload['items'] as $item ) : ?>
|
||||
@@ -220,5 +215,6 @@ function zeitfresser_render_floating_toc( $post_id = null ) {
|
||||
</ol>
|
||||
</nav>
|
||||
</aside>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
+25
-21
@@ -2,42 +2,46 @@
|
||||
/**
|
||||
* The template for displaying all single posts
|
||||
*
|
||||
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
get_header();
|
||||
?>
|
||||
<?php $show_hide_related_posts = get_theme_mod( 'post_detail_hide_show_related_articles', zeitfresser_get_default_post_detail_related_articles() ); ?>
|
||||
|
||||
// CLEAN: no default function anymore
|
||||
$show_hide_related_posts = get_theme_mod(
|
||||
'post_detail_hide_show_related_articles',
|
||||
true
|
||||
);
|
||||
?>
|
||||
|
||||
<div id="primary" class="inside-page content-area">
|
||||
<div class="container">
|
||||
<div class="main-wrapper">
|
||||
<section class="page-section full-width-view">
|
||||
<div class="detail-content">
|
||||
|
||||
<?php while ( have_posts() ) : the_post(); ?>
|
||||
<?php get_template_part( 'template-parts/content', 'single' ); ?>
|
||||
<?php endwhile; // End of the loop. ?>
|
||||
<?php the_post_navigation(); ?>
|
||||
<?php comments_template(); ?>
|
||||
<section class="page-section full-width-view">
|
||||
<div class="detail-content">
|
||||
|
||||
</div><!-- /.end of deatil-content -->
|
||||
<?php while ( have_posts() ) : the_post(); ?>
|
||||
<?php get_template_part( 'template-parts/content', 'single' ); ?>
|
||||
<?php endwhile; ?>
|
||||
|
||||
<?php
|
||||
if( $show_hide_related_posts ) {
|
||||
get_template_part('template-parts/related', 'articles');
|
||||
}
|
||||
?>
|
||||
</section> <!-- /.end of section -->
|
||||
<?php the_post_navigation(); ?>
|
||||
<?php comments_template(); ?>
|
||||
|
||||
<div class="sidebar"><?php get_sidebar();?></div>
|
||||
</div>
|
||||
|
||||
<?php if ( $show_hide_related_posts ) : ?>
|
||||
<?php get_template_part( 'template-parts/related', 'articles' ); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
</section>
|
||||
|
||||
<div class="sidebar">
|
||||
<?php get_sidebar(); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
get_footer();
|
||||
<?php get_footer(); ?>
|
||||
|
||||
@@ -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