Jump to content

need a wordpress loop to put in the sidebar


Mushir

Recommended Posts

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?!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.