I don't know if I'm retarded, crazy or just plain genius or not, but I've decided to use tags as a way to link content site-wide (a big ol' many-to-many relationship website for archiving various aspects of a huge project). Unfortunately, this means that some custom post types utilised by some plugins don't exactly link up properly with other objects (posts, pages, etc.) as they use other taxonomies (and in the case of media 'attachments' they don't use taxonomies at all, unless I pork in a plugin to fix that -- which there is and I'm using it and it uses a different taxonomy...). Actually, some plugin types have specific taxonomies hard-coded in so I can't really go through and change their core code or else a plugin upgrade would wipe all my hard work.
To address this fragmentation and perception of long, arduous work of hacking the plugins and/or Wordpress, I initially used the Advanced Taxonomy stuff with
WP_Query and that was working well, until I found I needed some extra information with meta tags and to even change the default ordering based on the
meta_values specific to the
post_type. So now I'm going the shorter "long, arduous" work route and have written my own custom SQL builder to fetch the objects based on the tag/meta relationships with the custom ordering per
post_type as required by the project.
One thing I'd love to do, so I can use both this new custom query and the existing
WP_Query methods, is find out some way to wrap the custom query results in a
WP_Query class so I can use
the_post -- basically all the nice
$wpdb->get_results only gives me a plain array of results and I'm not so clued up on
$wpdb's niggly bits; can
WP_Query let me do some funky custom selects, joins and then order based on the columns selected? Can I just flick an SQL query to
get_posts() to get the
WP_Query wrapper and its glorious Loop functionality?
It's late and I'm oh-so-close to solving this riddle, so I'd appreciate your help, Obi Wan Kenobi; For the moment the simplest solution looks to be the
have_posts() functionality applied to a plain array of post results retrieved via the
$wpdb->get_results function, to then easily and seamlessly initiate a WP Loop on that set of post results. If you may know of any other way to do this (Custom Queries, mayhaps?) I'm all ears.