I recently needed to sort posts by values saved in a meta value field. The normal post object only has a reference to the meta values so I needed to figure out how to add a meta key, meta value, and direction to WP_Query. Here is what I did:The meta key: event-detailsThe meta value: a:1:{i:0;a:7:{s:16:"event-start-date";s:10:"03-04-2014";s:14:"event-location";s:15:"Someplace, USA";s:10:"event-logo";s:4:"4301";s:10:"event-type";s:5:"Event";s:10:"event-link";s:36:"http://www.company.com/";s:10:"event-time";s:0:"";s:14:"event-end-date";s:10:"03-05-2014";}}The...
Thursday, March 13, 2014
The Big "C" Has Invaded My Life
I'm fairly young, 46 as I write this, not in shape like my Marine days, but I can generally hold my own. But of all the things I thought would come my way this year health wise, the one thing that wasn't on my radar, even remotely, was cancer.Saying cancer isn't as tough as I thought it would be. What's tougher are the emotions that come along with it. The what's next, the when's, the why's, the how longs, pissed my wife has to deal with this, pissed my kids have to deal with this, and grateful for all the love and support...
Saturday, March 1, 2014
Tuesday, February 25, 2014
Adding A WordPress Category To Imported Posts
One feature I've either missed over the years or doesn't exist, is the ability to add more meta data to imported posts. Here is the scenario:New WordPress siteImporting old WordPress content into new siteWant to add a new category to all posts (or tag)User custom template page to display new posts (category-foo.php)So how do we solve this issue? Here is what I did. This may not be the best or optimum way, and as a disclaimer, unless you fully understand databases, sql syntax, and how WordPress ties posts and meta data, this...
Subscribe to:
Posts (Atom)