Mushir Posted January 20, 2014 Share Posted January 20, 2014 Hi everybody I came here after I ran out of options and i don't know if it's the right section to post my question but I'm desperate for any help : I'm woking in wordpress theme project I need WordPress loop to do the following : check if there is no sidebar widgets active then get 5 recent posts with only titles and thumbnails But here is the thing : I don't want the loop to get the featured post thumbnails but a unique thumbnail based on post category and get them form a folder in the theme directory named:" images" where I will put image for each category in this folder so that the loop get them by category ID or slug maybe. I hope I made it clear to you cause I'm stuck with a project and I need help from php expert. I have code I don't know if it's useful or mabe tweaked : <ul id="recent-comments"> <?php $pc = new WP_Query('orderby=comment_count&posts_per_page=5'); ?> <?php while ($pc->have_posts()) : $pc->the_post(); ?> <li> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(array(75,75)); ?></a> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a> </li> <?php endwhile; ?> </ul> I am using child theme for twenty twelve theme note : my client is has strong no plugins policy! anyone up for the challenge?! Link to comment https://forums.phpfreaks.com/topic/285509-need-a-wordpress-loop-to-put-in-the-sidebar/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.