audio_player_add( 'WPTRT\\Customize\\Section', get_theme_file_path( 'vendor/wptrt/customize-section-button/src' ) );
$Audio_Player_Loader->audio_player_register();
if ( ! function_exists( 'audio_player_setup' ) ) :
function audio_player_setup() {
load_theme_textdomain( 'audio-player', get_template_directory() . '/languages' );
add_theme_support( 'woocommerce' );
add_theme_support( "responsive-embeds" );
add_theme_support( "align-wide" );
add_theme_support( "wp-block-styles" );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'title-tag' );
add_theme_support( 'post-thumbnails' );
add_image_size('audio-player-featured-header-image', 2000, 660, true);
register_nav_menus( array(
'primary' => esc_html__( 'Primary','audio-player' ),
'footer'=> esc_html__( 'Footer Menu','audio-player' ),
) );
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
add_theme_support( 'custom-background', apply_filters( 'audio_player_custom_background_args', array(
'default-color' => 'f7ebe5',
'default-image' => '',
) ) );
add_theme_support( 'customize-selective-refresh-widgets' );
add_theme_support( 'custom-logo', array(
'height' => 50,
'width' => 50,
'flex-width' => true,
) );
add_editor_style( array( '/editor-style.css' ) );
}
endif;
add_action( 'after_setup_theme', 'audio_player_setup' );
function audio_player_content_width() {
$GLOBALS['content_width'] = apply_filters( 'audio_player_content_width', 1170 );
}
add_action( 'after_setup_theme', 'audio_player_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function audio_player_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'audio-player' ),
'id' => 'sidebar',
'description' => esc_html__( 'Add widgets here.', 'audio-player' ),
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Column 1', 'audio-player' ),
'id' => 'audio-player-footer1',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Column 2', 'audio-player' ),
'id' => 'audio-player-footer2',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Column 3', 'audio-player' ),
'id' => 'audio-player-footer3',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'audio_player_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function audio_player_scripts() {
require_once get_theme_file_path( 'inc/wptt-webfont-loader.php' );
wp_enqueue_style(
'ubuntu',
wptt_get_webfont_url( 'https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap' ),
array(),
'1.0'
);
wp_enqueue_style(
'libre-baskerville',
wptt_get_webfont_url( 'https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&display=swap' ),
array(),
'1.0'
);
wp_enqueue_style( 'audio-player-block-editor-style', get_theme_file_uri('/assets/css/block-editor-style.css') );
// load bootstrap css
wp_enqueue_style( 'bootstrap-css', get_template_directory_uri() . '/assets/css/bootstrap.css');
wp_enqueue_style( 'owl.carousel-css', get_template_directory_uri() . '/assets/css/owl.carousel.css');
wp_enqueue_style( 'audio-player-style', get_stylesheet_uri() );
require get_parent_theme_file_path( '/custom-option.php' );
wp_add_inline_style( 'audio-player-style',$audio_player_theme_css );
// fontawesome
wp_enqueue_style( 'fontawesome-style', get_template_directory_uri() .'/assets/css/fontawesome/css/all.css' );
wp_enqueue_script('audio-player-theme-js', get_template_directory_uri() . '/assets/js/theme-script.js', array('jquery'), '', true );
wp_enqueue_script('owl.carousel-js', get_template_directory_uri() . '/assets/js/owl.carousel.js', array('jquery'), '', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'audio_player_scripts' );
/**
* Enqueue Preloader.
*/
function audio_player_preloader() {
$audio_player_theme_color_css = '';
$audio_player_preloader_bg_color = get_theme_mod('audio_player_preloader_bg_color');
$audio_player_preloader_dot_1_color = get_theme_mod('audio_player_preloader_dot_1_color');
$audio_player_preloader_dot_2_color = get_theme_mod('audio_player_preloader_dot_2_color');
$audio_player_logo_max_height = get_theme_mod('audio_player_logo_max_height');
if(get_theme_mod('audio_player_logo_max_height') == '') {
$audio_player_logo_max_height = '24';
}
if(get_theme_mod('audio_player_preloader_bg_color') == '') {
$audio_player_preloader_bg_color = '#ffffff';
}
if(get_theme_mod('audio_player_preloader_dot_1_color') == '') {
$audio_player_preloader_dot_1_color = '#12aff5';
}
if(get_theme_mod('audio_player_preloader_dot_2_color') == '') {
$audio_player_preloader_dot_2_color = '#000000';
}
$audio_player_theme_color_css = '
.custom-logo-link img{
max-height: '.esc_attr($audio_player_logo_max_height).'px;
}
.loading{
background-color: '.esc_attr($audio_player_preloader_bg_color).';
}
@keyframes loading {
0%,
100% {
transform: translatey(-2.5rem);
background-color: '.esc_attr($audio_player_preloader_dot_1_color).';
}
50% {
transform: translatey(2.5rem);
background-color: '.esc_attr($audio_player_preloader_dot_2_color).';
}
}
';
wp_add_inline_style( 'audio-player-style',$audio_player_theme_color_css );
}
add_action( 'wp_enqueue_scripts', 'audio_player_preloader' );
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Functions which enhance the theme by hooking into WordPress.
*/
require get_template_directory() . '/inc/template-functions.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/* TGM. */
require get_parent_theme_file_path( '/inc/tgm.php' );
/**
* Meta Feild
*/
require get_stylesheet_directory() . '/inc/feature-meta.php';
function audio_player_sanitize_select( $input, $setting ){
$input = sanitize_key($input);
$choices = $setting->manager->get_control( $setting->id )->choices;
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
}
/*radio button sanitization*/
function audio_player_sanitize_choices( $input, $setting ) {
global $wp_customize;
$control = $wp_customize->get_control( $setting->id );
if ( array_key_exists( $input, $control->choices ) ) {
return $input;
} else {
return $setting->default;
}
}
function audio_player_sanitize_number_absint( $number, $setting ) {
// Ensure $number is an absolute integer (whole number, zero or greater).
$number = absint( $number );
// If the input is an absolute integer, return it; otherwise, return the default
return ( $number ? $number : $setting->default );
}
function audio_player_sanitize_checkbox( $input ) {
// Boolean check
return ( ( isset( $input ) && true == $input ) ? true : false );
}
/*dropdown page sanitization*/
function audio_player_sanitize_dropdown_pages( $page_id, $setting ) {
$page_id = absint( $page_id );
return ( 'publish' == get_post_status( $page_id ) ? $page_id : $setting->default );
}
if (!function_exists('audio_player_loop_columns')) {
function audio_player_loop_columns() {
return 3;
}
}
add_filter('loop_shop_columns', 'audio_player_loop_columns');
/**
* Get CSS
*/
function audio_player_getpage_css($hook) {
if ( 'appearance_page_audio-player-info' != $hook ) {
return;
}
wp_enqueue_style( 'audio-player-demo-style', get_template_directory_uri() . '/assets/css/demo.css' );
}
add_action( 'admin_enqueue_scripts', 'audio_player_getpage_css' );
function audio_player_page_redirection() {
global $pagenow;
if (isset($_GET['activated']) && ('themes.php' == $pagenow) && is_admin()) {
wp_safe_redirect(admin_url("themes.php?page=audio-player-info.php"));
}
}
add_action('after_setup_theme', 'audio_player_page_redirection');
if ( ! defined( 'AUDIO_PLAYER_CONTACT_SUPPORT' ) ) {
define('AUDIO_PLAYER_CONTACT_SUPPORT',__('https://wordpress.org/support/theme/audio-player/','audio-player'));
}
if ( ! defined( 'AUDIO_PLAYER_REVIEW' ) ) {
define('AUDIO_PLAYER_REVIEW',__('https://wordpress.org/support/theme/audio-player/reviews/','audio-player'));
}
if ( ! defined( 'AUDIO_PLAYER_LIVE_DEMO' ) ) {
define('AUDIO_PLAYER_LIVE_DEMO',__('https://themagnifico.net/demo/audio-music/','audio-player'));
}
if ( ! defined( 'AUDIO_PLAYER_GET_PREMIUM_PRO' ) ) {
define('AUDIO_PLAYER_GET_PREMIUM_PRO',__('https://www.themagnifico.net/themes/audio-wordpress-theme/','audio-player'));
}
if ( ! defined( 'AUDIO_PLAYER_PRO_DOC' ) ) {
define('AUDIO_PLAYER_PRO_DOC',__('https://www.themagnifico.net/eard/wathiqa/audio-music-doc/','audio-player'));
}
add_action('admin_menu', 'audio_player_themepage');
function audio_player_themepage(){
$audio_player_theme_test = wp_get_theme();
$audio_player_theme_info = add_theme_page( __('Theme Options','audio-player'), __(' Theme Options','audio-player'), 'manage_options', 'audio-player-info.php', 'audio_player_info_page' );
}
function audio_player_info_page() {
$audio_player_theme_user = wp_get_current_user();
$audio_player_theme = wp_get_theme();
?>