initial upload
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?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 );
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
jQuery( function( $ ) {
|
||||
|
||||
wp.customize('container_width',function ( value ) {
|
||||
value.bind(function ( to ) {
|
||||
document.body.style.setProperty('--container-width', to+"px");
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
} );
|
||||
@@ -0,0 +1,17 @@
|
||||
<?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;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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__ ) . '/../post-snippet/default-post-snippet.php';
|
||||
require dirname( __FILE__ ) . '/../post-snippet/excerpt/excerpt.php';
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* Social links customizer settings.
|
||||
*
|
||||
* @package zeitfresser
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'zeitfresser_get_social_links' ) ) {
|
||||
/**
|
||||
* Return supported social network labels.
|
||||
*
|
||||
* @return array<string,string>
|
||||
*/
|
||||
function zeitfresser_get_social_links() {
|
||||
return array(
|
||||
'facebook' => esc_html__( 'Facebook', 'zeitfresser' ),
|
||||
'instagram' => esc_html__( 'Instagram', 'zeitfresser' ),
|
||||
'youtube' => esc_html__( 'Youtube', 'zeitfresser' ),
|
||||
'linkedin' => esc_html__( 'LinkedIn', 'zeitfresser' ),
|
||||
'twitter' => esc_html__( 'Twitter', 'zeitfresser' ),
|
||||
'pinterest' => esc_html__( 'Pinterest', 'zeitfresser' ),
|
||||
'tiktok' => esc_html__( 'TikTok', 'zeitfresser' ),
|
||||
'mastodon' => esc_html__( 'Mastodon', 'zeitfresser' ),
|
||||
'github' => esc_html__( 'GitHub', 'zeitfresser' ),
|
||||
'matrix' => esc_html__( 'Matrix.org', 'zeitfresser' ),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
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>';
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'social_links_title',
|
||||
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,
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$social_priority = 21;
|
||||
|
||||
foreach ( $social_links as $social_key => $social_label ) {
|
||||
$wp_customize->add_setting(
|
||||
'social_links_' . $social_key,
|
||||
array(
|
||||
'default' => zeitfresser_get_social_link_default( $social_key ),
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'social_links_' . $social_key,
|
||||
array(
|
||||
'label' => $social_label,
|
||||
'section' => 'daisy_blog_general_customization_section',
|
||||
'type' => 'url',
|
||||
'priority' => $social_priority++,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user