post_class outside the loop??
-
global $wpdb; $posts = $wpdb->get_results($request); foreach ($posts as $post) { setup_postdata($post); $post_title = apply_filters('the_title', $post->post_title); $comment_count = $post->comment_count; $gcont = get_the_content(); $mdv_most_commented .= '<dt' . post_class('', $post->ID) .'>' . $post_title . ' */ ' . $comment_count . '</dt>' . '<dd class="postcontent">' . $gcont . ' */' . '</dd>';
now, post_class displays classes for all the posts in one go, why?
it does not even stay in <dt> tags but jumps out to the front before all the posts’ content, like this:class=”post-21 post hentry category-fedora”class=”post-30 post hentry category-films-ive-watched”class=”post-2 page hentry”class=”post-3 post hentry category-films-ive-watched”class=”post-10 post hentry category-music-is-the-panacea”
intentions */ 1 —- here is first post
ethernal sunshine of the spotless mind */ 1
About */ 0
children */ 0
myslovitz */ 0
…why is it not working?
cheers
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘post_class outside the loop??’ is closed to new replies.