Where there is a will, there is a way π Most of the time anyway. If it can be done with PHP, then it is possible. It largely depends on how predictable the links are and how unlikely it is to mistakenly pick up the wrong link. For example, if the music link is always from soundcloud or always from a specific local folder, and no other similar links will ever be used, then this is doable. Even better will be if the music is always uploaded through the media library and inserted into a post. Then there will be an attachment post that is a child of the blog post that refers to the media.
In the media library case, a widget would query for the latest post, determine the related attachment, get the link and display it. Something is still possible with other ways of embedding links, but it’s more work to extract the right data.
Hi,
well, the music link would be always from the media library (inside WP). The situation you describe is exactly the case, it’s a post with embedded audio from the media library.
Do I just need to make a PHP code for this, that I will insert in a PHP-widget, or do I need to make an extra plugin for that?
Any recommended way of introducing PHP into WP will work. PHP widget, plugin, or child theme. If you already have a site specific custom plugin, you can add to that. Conversely, if you create a plugin for this, you can also use the same for any other additional PHP you end up wanting to do. While a PHP widget is an easy solution, having a custom plugin to throw any desired code into is really worth having IMO.
Alright, thank you very much bcworkz π