Ive been looking and am unable to find a working solution. Here is the example:
I created a custom post type called "ads". The objective is to be able to create posts under ads and have them show up in there desired template. Im able to do this but I created 3 Custom Categories and am not able to use that for filtering.
my code is:
<?php query_posts('post_type=ads&posts_per_page=4&tag=home-above&orderby=rand'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php if ( function_exists('has_post_thumbnail') && has_post_thumbnail($post->ID) ) {
$thumbnail = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), full ); ?>
<img class="has-tip tip-top" data-width="210" title="<?php the_field('hover_text'); ?>" src="<?php echo $thumbnail[0]; ?>" />
<?php }else{ ?>
<img src="/DetroitSounds/wp-content/uploads/2013/01/youradhere.jpg" />
<?php } ?>
<?php endwhile; ?>
<?php endif; wp_reset_query();?>
The custom categories names are "Home Page Above" ( slug=home-page-above ), "Home Page Below" ( slug=home=page-below ) and Inner Pages ( slug=inner-pages )
In the above code I have a tag which is actually achieving the effect I want, but Im afraid the backend usability is not as straight forward for the client.
Im also a bit confused if I'm even using that taxonomy correctly?
Any ideas would be great. Thanks
query_posts
, it is unreliable, breaks the main query and fails in most situations on pagination. Rather useWP_Query
– Pieter Goosen