I have a post with 2 column layout. The first column has an mp3 player. I am thinking of adding a Lyrics window in the second column. Based on the song selected by the user, the Lyrics window will display the Song Lyrics. (without refreshing the whole page). Is this possible in a self-hosted wordpress site? Thanks for helping.
Some things you will need to think about include how you are going to retrieve the lyrics, i.e. are you going to get the information from another site, store the lyrics within your own database or maybe a site has an api which will allow you to get the information.
The following process will most likely be initiated by the user clicking a song or clicking the next button, or choosing a song from a drop down menu depending on your setup. From the Demo page for this plugin it seems more like clicking a song or the next button.
In short you will need to get the text from the div with a class called
You will need to use the jquery ajax methods to send the value to your php file which contains the logic. This implies that you would have an sql statement which resembles the following:
This can be messy and you might want to find out an easier way to reference songs maybe using a synthetic key or some other technique.
So if this is successful you can return the results from your php file to the jquery ajax request.
You will then target the div in which you want to display the lyrics and use jquery to append the data. Remember to use
So a bit of jQuery, ajax, php, sql and you will be fine, especially to avoid page reloads. Hope this somewhat guides you in the right direction. It would be nice to provide code examples, but as you can see this is a ton of work.
Get a useful IDE, utilise xdebug and firebug is your friend.