ThemeShaper Forums » Thematic

[closed]

Question about using Category/Post Query as a Thesis-like Teaser box

(3 posts)
  • Started 10 years ago by yannibmbr
  • Latest reply from yannibmbr
  • This topic is not resolved
  1. Hello all,
    I have a question that I'm sure has been discussed, but I haven't been able to find what I'm looking for in the forums specifically.

    I have a site that I'm moving to Thematic from Thesis here: http://bauhaus.digisavvy.com. The existing thesis-based site is here: http://bauhausproperties.com

    What I'd like to do is create a post query that would pull x number of posts from a certain category, possibly multiple categories. and display them at the end of the content only on the home page. If possible, I'd like to include the posts thumbnail as well.

    I'm not sure how to achieve this. Would it be done with excerpts, or would I be better doing some sort of post query?

    I hope this makes sense.

    Posted 10 years ago #
  2. The post query method method works well for me:

    I take:

    <?php
    
               $featurePosts = new WP_Query();
               $featurePosts->query('category_name='Your_Category'&showposts='5');
    ?>
    
    <?php while ($featurePosts->have_posts()) : $featurePosts->the_post(); ?>

    ...and I stick it into my home page via add_action hook. Wrap it in an if (is_home()) or if (is_front_page) to suit your site. You can use the_excerpt in place of the_post...or go crazy and just do titles..

    <?php while ($featurePosts->have_posts()) : $featurePosts->the_post(); ?>
                      <li><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></li>
                  <?php endwhile; ?>

    gettin images...that's cat skinning imo. I chose to use Justin Tadlocks get_the_image plugin in my most recent project, but it doesn't allow for the same flexibility in image sizes that timthumb.php seems to accommodate via resize/cropping, but I found Justin's script easier to use. WP also has built in thumbnail support now in 3.0. Googling any of these ideas will get you squared away pretty quickly.

    Posted 10 years ago #
  3. That looks quite promising! Thank you. I will give this a try and see what I get.

    Posted 10 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.