introduce
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user