Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Sorting WordPress Content by Song Title & Artist

Featured Replies

Hi everyone,

 

I've got a client who runs a karaoke service, and one of the main content areas of the site is a list of songs that his customers can choose to sing. He has provided the songlist to me, organized alphabetically by song title. My plan was to create a post for each letter (A - Z), and then allow him to enter new songs in the post body as he sees fit.

 

However, he has asked if the end users can have the option of sorting songs by title or by artist, and as far as I'm aware, there's no way to "rearrange" published post content. I'm not too keen on the idea of having a post for every song, but if that's what has to happen then I guess I'll have to do it. But even then, I still have no idea how to allow the website users to choose how content gets sorted.

 

Any thoughts, tips or plugin suggestions?

 

Thanks,

 

Chris

actually there are a couple of ways to do that !

have you seen sortable tables ? it's a table with javascript that can sort any column or even filter, if you can put the data into the table ,the table would do the rest of the job.

 

you can use this keyword to do a google search : sortable table javascript

 

OR you can checkout this one ,it's pretty easy .

this one is cool too ,this one has filters .

 

another way would be to use a custom post type,but it would be a lot of theme editing to implement sorting for wp query.

 

I would go with first option,it's more convenient and easier .

The table idea could work well with a custom loop. Your loop dynamically fills the table with the relevant information, i.e. a row for each post (first cell post title, second cell artist name etc) then as Danny87 says, you can use jQuery to re-arrange. My concern would be if there's a lot of posts in one table, it could be a little slow, one way around this is to display a loading image whilst the user waits, but if it's a really long wait you might need to split up the tables a bit.

  • Author

Gentlemen,

 

Brilliant stuff. Thanks so much for your advice. Works a treat, and was super easy to get up and running...particularly for someone who knows bugger all about Javascript. ;)

 

Thanks again.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.