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

Edited by Mushir
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.