How to Sort Newsmag WordPress Posts by Views [Custom Function]


Newsmag is one of the most popular magazine themes for WordPress. It is highly customizable, so you can use it to create sophisticated layouts for any type of website. It has various post and category styles for you to choose from. It can even track views on your posts. While you can view this information in the back-end, you can’t easily sort your posts by views. At least I couldn’t find an easy way to do so.

The above function adds a custom views column, which you can use to sort your posts. The below code makes this column sortable. You will just have to add this code to your functions.php file, and the rest is easy.

As you can see in the below GIF, after adding the functions, I was able to sort my posts by views. I was even able to find a few old posts that had missed their schedule.

Stay tuned as we will cover more WordPress theme specific plugins and tips in the future.

More WordPress reading: