开发者

WordPress: output custom post type not displaying

I'm trying to output a custom post type but nothing shows up. The code is very simple - what could I be missing?

<?php
$favorites = new WP_Query(array('post_type' => 'favorites', 'posts_per_page' => 10));

while ($favorites->have_p开发者_开发百科osts()) : $favorites->the_post();

echo '<li><a href="' . bloginfo('template_directory') . the_post_thumbnail('large') . '" rel="thumbnail" title="&lt;a href=\'' .   simple_fields_get_post_value(get_the_id(), array(8, 3), true) . '\'&gt;' . the_title() . '&lt;/a&gt;"><img class="rounded" src="' . bloginfo('template_directory') .     the_post_thumbnail(array(101,99)) . '" alt="' . the_title() . '" /></a></li>';

endwhile;
?>


Have you checked that;

  • You have definitely registered a post type called favorites (note plural)
  • The browser is not choking on your markup (your HTML is invalid - for starters, you should wrap list items in a <ul>
  • The function simple_fields_get_post_value() exists and is working correctly
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜