I have a wp query that works great – it returns a list of featured posts.
WP_Query(“category_name=office&meta_key=featured_post&meta_value=Yes&posts_per_page=3”);
However I want to add a 2nd custom key to the query (a custom order field) then order by the numerical value of the meta value of this key.. is it possible to use 2 meta_key values in a WP_Query? If not is it possible using an SQL query statement?
The query value parameters can be set to true ( returns single result) or false ( an array).
http://codex.wordpress.org/Function_Reference/get_post_meta
For instance http://www.mattvarone.com/wordpress/query-multiple-meta-values/
Typically in WordPress you would never go use database calls/SQL Calls (your second question)
(on your first question: how to add multiple metadata values (and do the wildest things with them)) use kind the following for additional entries in your Query, the join and orderby are used here for other possible relations between meta keys. In the example you see that I order on the A*B values of the keys. Just copy and paste and adjust to your liking. (note that apart from join and orderby there are more options to play with in case of even more advanced scenarios).
If you want to then show certain fields based on calculations of the meta data you can use e.g.:
which is actually the following method in that class:
where the method GetValuesFromWP() is from the wp metadata class :
(so in the join function totally above do the stuff you want).
see also: Getting Custom Field data from a page hierarchy