Hi, you can use the following code to only play in the home page.
<?php
if(is_front_page()){
echo do_shortcode('[sc_embed_player fileurl="URL OF THE MP3 FILE" autoplay="true"]');
}
?>
You can also use page Id as per the following documentation.
https://developer.wordpress.org/reference/functions/is_page/
Also, it is good practice to load scripts in the footer instead of the header: wp_enqueue_script(“scap.soundmanager2-js”, “…/soundmanager2-nodebug-jsmin.js”, [], null, true);
In regards to the above, I have submitted a message to the developers to investigate further your request.
Thank you
I already understand how to use the shortcode.
The problem is that Compact WP Audio Player load its styles and scripts on every single page, whether or not it is being used.
To maintain performance, I currently have to add the following…
$page = $_SERVER["REQUEST_URI"];
if ($page !== "/media/")
add_action("init", function () {
remove_action('init', 'wp_sc_audio_init');
remove_action('wp_footer', 'scap_footer_code');
});
A good example of what I mean would be in the Header Footer Code Manager plugin, that has a Site Display: Specific Pages option.
Hi, I have submitted a message to the developers to investigate further your request.
Kind regards