Your IP : 216.73.216.1
<?php
/**
* pally Meta Info Options
*
* @package pally
* @since 1.0.0
*/
namespace Pally;
use WP_Customize_Manager;
/**
* Options for the blog, search and archive pages.
*
* @since 1.0.0
*/
class Metainfo_Options {
/**
* Constructor.
*
* @since 1.0.0
* @access public
*/
public function __construct() {
add_action( 'customize_register', [ $this, 'action_register_customizer_control' ] );
}
/**
* Adds a Customizer section, settings, controls and partials.
*
* @param WP_Customize_Manager $wp_customize Customizer manager instance.
* @access public
* @since 1.0.0
*/
public function action_register_customizer_control( WP_Customize_Manager $wp_customize ) {
$wp_customize->add_section(
'metainfo_options',
array(
'title' => __( 'Meta-Info Blog', 'pally' ),
'panel' => 'theme_options',
'priority' => 3,
)
);
$wp_customize->add_setting(
'archive_show_date',
array(
'default' => true,
'sanitize_callback' => 'Pally\Customizer::sanitize_checkbox',
)
);
$wp_customize->add_control(
'archive_show_date',
array(
'type' => 'checkbox',
'label' => __( 'Show publishing date', 'pally' ),
'description' => __( 'Show or hide the publishing date', 'pally' ),
'section' => 'metainfo_options',
)
);
$wp_customize->add_setting(
'publishing_date_text',
[
'default' => '',
'sanitize_callback' => 'sanitize_text_field',
]
);
$wp_customize->add_control(
'publishing_date_text',
[
'type' => 'text',
'label' => __( 'Posted on Text', 'pally' ),
'description' => __( 'Add an optional text to show before the publishing date. Examples: Posted on, Published on. Leave the field empty to only show the date.', 'pally' ),
'section' => 'metainfo_options',
]
);
$wp_customize->add_setting(
'archive_show_author',
array(
'default' => true,
'sanitize_callback' => 'Pally\Customizer::sanitize_checkbox',
)
);
$wp_customize->add_control(
'archive_show_author',
array(
'type' => 'checkbox',
'label' => __( 'Show author name', 'pally' ),
'description' => __( 'Show or hide the author name', 'pally' ),
'section' => 'metainfo_options',
)
);
$wp_customize->selective_refresh->add_partial(
'archive_show_author',
array(
'selector' => '.type-post .posted-by',
)
);
$wp_customize->add_setting(
'posted_by',
[
'default' => '',
'sanitize_callback' => 'sanitize_text_field',
]
);
$wp_customize->add_control(
'posted_by',
[
'type' => 'text',
'label' => __( 'Written by Text', 'pally' ),
'description' => __( 'Add an optional text to show before the author name. Examples: Posted by, Published by. Leave the field empty to only show the author name.', 'pally' ),
'section' => 'metainfo_options',
]
);
$wp_customize->add_setting(
'archive_show_categories',
array(
'default' => true,
'sanitize_callback' => 'Pally\Customizer::sanitize_checkbox',
)
);
$wp_customize->add_control(
'archive_show_categories',
array(
'type' => 'checkbox',
'label' => __( 'Show categories', 'pally' ),
'description' => __( 'Show or hide the categories', 'pally' ),
'section' => 'metainfo_options',
)
);
$wp_customize->add_setting(
'category_text',
[
'default' => __( 'Published under:', 'pally' ),
'sanitize_callback' => 'sanitize_text_field',
]
);
$wp_customize->add_control(
'category_text',
[
'type' => 'text',
'label' => __( 'Published under Text', 'pally' ),
'description' => __( 'Add an optional text to show before the categories. Examples: Categories:, Published under. Leave the field empty to only show the list of categories.', 'pally' ),
'section' => 'metainfo_options',
]
);
$wp_customize->add_setting(
'archive_show_tags',
array(
'default' => false,
'sanitize_callback' => 'Pally\Customizer::sanitize_checkbox',
)
);
$wp_customize->add_control(
'archive_show_tags',
array(
'type' => 'checkbox',
'label' => __( 'Show tags', 'pally' ),
'description' => __( 'Show or hide the tags', 'pally' ),
'section' => 'metainfo_options',
)
);
$wp_customize->add_setting(
'tags_text',
[
'default' => 'Tagged: ',
'sanitize_callback' => 'sanitize_text_field',
]
);
$wp_customize->add_control(
'tags_text',
[
'type' => 'text',
'label' => __( 'Tags Text', 'pally' ),
'description' => __( 'Add an optional text to show before the tags. Examples: Tags: , Published under , Tagged: . Leave the field empty to only show the list of tags.', 'pally' ),
'section' => 'metainfo_options',
]
);
}
}