admin管理员组

文章数量:1302408

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 4 years ago.

Improve this question

I am using the plugin ‘WP Maintenance Mode’ to load a under maintenance website on a website.

I would like for audio to play as soon as somebody lands on the website and for audio player to remain invisible.

<p style="text-align: center;">BACK SOON</p>

[audio src="https://myWebsite/wp-content/uploads/2021/03/audio.mp3"]

This will load the page and show the audio player and it will play when I press play

I have tried

[audio src="https://myWebsite/wp-content/uploads/2021/03/audio.mp3 width = "0" height = "0" autoplay=1]

to try and get it to play automatically and without the audio player, but no success.

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 4 years ago.

Improve this question

I am using the plugin ‘WP Maintenance Mode’ to load a under maintenance website on a website.

I would like for audio to play as soon as somebody lands on the website and for audio player to remain invisible.

<p style="text-align: center;">BACK SOON</p>

[audio src="https://myWebsite/wp-content/uploads/2021/03/audio.mp3"]

This will load the page and show the audio player and it will play when I press play

I have tried

[audio src="https://myWebsite/wp-content/uploads/2021/03/audio.mp3 width = "0" height = "0" autoplay=1]

to try and get it to play automatically and without the audio player, but no success.

Share Improve this question edited Mar 2, 2021 at 21:44 fuxia 107k38 gold badges255 silver badges459 bronze badges asked Mar 2, 2021 at 15:33 user202731user202731 1 3
  • The documentation says it's autoplay="on" – Rup Commented Mar 2, 2021 at 15:43
  • Can you get this to work on a normal page? Is it just the maintenance mode page where this doesn't work? – Rup Commented Mar 2, 2021 at 15:44
  • 1 Browsers are very particular about things that autoplay, especially things with sound. You may find that what you want isn't possible on some major browsers. As for the WP Maintenance plugin, I don't see that it's related to this question other than circumstance, people might think this is a problem specific to that plugin and vote to close the question – Tom J Nowell Commented Mar 2, 2021 at 16:02
Add a comment  | 

1 Answer 1

Reset to default 1

A couple of things:

  • First, this code has some syntax issues - the src attribute isn't properly closed. Further, as noted by @Rup, autoplay should have a value of on:

Broken tag:

[audio src="https://myWebsite/wp-content/uploads/2021/03/audio.mp3 width = "0" height = "0" autoplay=1]

Fixed

[audio src="https://myWebsite/wp-content/uploads/2021/03/audio.mp3" width="0" height="0" autoplay="on"]
  • Second, I'm not 100% sure that WP Maintenance posts can process shortcodes. I would instead use a standard HTML Audio Tag.

本文标签: Auto play audio using WP Maintenance Mode Plugin