Today while working over a premium WordPress theme I had to solve two problems. First of all I needed to build a custom WordPress query through which I could display posts from a particular term while excluding other particular terms. Secondly, I wanted to provide end-user with a select-2 based drop down menu to select from the present terms of a custom taxonomy. Context Think of a theme which displays three different blocks of posts on the homepage. Basically, I am building a theme for Easy Digital Downloads plugin. Now think again, at the homepage you need to add three different blocks of posts from three different terms of EDD’s Categories. Where EDD’s categories are based upon a custom taxonomy called download_category. Data Set Block #1: It will display posts from the term Featured from EDD categories while any post in terms Recent and Deals would be excluded Block #2: It will display posts from the term Recent from EDD categories while any post in terms Featured and Deals would be excluded Block #3: It will display posts from the term Deals from EDD categories while any post in terms Featured and Recent would be excluded Building a custom WPQuery First of all I needed to build
Share This