File manager - Edit - /home/monara/public_html/efm_web/wp-content/themes/newsberg/functions.php
Back
<?php /** * Theme functions and definitions * * @package Newsberg */ /*-------------------------------------------------------------- # 1. Force H5 Audio Player scripts to load on all pages --------------------------------------------------------------*/ function load_h5ap_scripts_everywhere() { if ( function_exists( 'h5ap_enqueue_scripts' ) ) { h5ap_enqueue_scripts(); } } add_action('wp_enqueue_scripts', 'load_h5ap_scripts_everywhere'); /*-------------------------------------------------------------- # 2. Enqueue theme styles --------------------------------------------------------------*/ function newsberg_enqueue_styles() { // Parent and child styles wp_enqueue_style( 'newsup-style-parent', get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'newsberg-style', get_stylesheet_directory_uri() . '/style.css', array( 'newsup-style-parent' ), '1.0' ); // Bootstrap wp_enqueue_style('bootstrap', get_template_directory_uri() . '/css/bootstrap.css'); // Color styles wp_dequeue_style( 'newsup-default', get_template_directory_uri() .'/css/colors/default.css'); wp_enqueue_style( 'newsberg-default-css', get_stylesheet_directory_uri()."/css/colors/default.css" ); // RTL support if(is_rtl()){ wp_enqueue_style( 'newsup_style_rtl', trailingslashit( get_template_directory_uri() ) . 'style-rtl.css' ); } } add_action( 'wp_enqueue_scripts', 'newsberg_enqueue_styles', 9999 ); /*-------------------------------------------------------------- # 3. Theme setup (custom header support) --------------------------------------------------------------*/ function newsberg_setup() { $args = array( 'default-image' => get_stylesheet_directory_uri() .'/images/head-back.jpg', 'width' => '1600', 'height' => '600', 'flex-height' => false, 'flex-width' => false, 'header-text' => true, 'default-text-color' => '#143745' ); add_theme_support( 'custom-header', $args ); } add_action( 'after_setup_theme', 'newsberg_setup' ); /*-------------------------------------------------------------- # 4. Register widget areas --------------------------------------------------------------*/ function newsberg_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Front-Page Right Sidebar Section', 'newsberg'), 'id' => 'front-right-page-sidebar', 'description' => '', 'before_widget' => '<div id="%1$s" class="mg-widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h6>', 'after_title' => '</h6>', ) ); register_sidebar( array( 'name' => esc_html__( 'Front-Page Left Sidebar Section', 'newsberg'), 'id' => 'front-left-page-sidebar', 'description' => '', 'before_widget' => '<div id="%1$s" class="mg-widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h6>', 'after_title' => '</h6>', ) ); unregister_sidebar( 'front-page-sidebar' ); } add_action( 'widgets_init', 'newsberg_widgets_init', 99 ); /*-------------------------------------------------------------- # 5. Remove parent theme page templates --------------------------------------------------------------*/ function newsberg_remove_page_templates( $page_templates ) { unset( $page_templates['template-frontpage.php'] ); return $page_templates; } add_filter( 'theme_page_templates', 'newsberg_remove_page_templates' ); /*-------------------------------------------------------------- # 6. Floating H5 Audio Player (appears on all pages) --------------------------------------------------------------*/ add_action('wp_footer', function() { echo '<div id="floating-audio-player" style=" position: fixed; bottom: 20px; right: 50px; width: 300px; z-index: 9999; /* solid red background */ padding: 10px; border-radius: 5px; ">'; echo do_shortcode('[radio_player id=1]'); echo '</div>'; // Mobile responsiveness echo '<style> @media only screen and (max-width: 768px) { #floating-audio-player { right: 50%; transform: translateX(50%); width: 90%; bottom: 15px; } } </style>'; });
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.05 |
proxy
|
phpinfo
|
Settings