ThemeShaper Forums » Thematic

[closed]

Category excerpts with thumbnails

(5 posts)
  • Started 10 years ago by beanfair
  • Latest reply from beanfair
  • This topic is not resolved
  1. beanfair
    Member

    I am needing to create a custom page template that allows my client to insert and edit text like a traditional page but will also show the last 10 excerpts of a specific category with thumbnail images.

    I got the categories showing up as a list of permalinks on the page from posts on this forum

      <?php
      $args = array( 'numberposts' => 10, 'orderby' => 'ASC', 'category' => 4 );
      $rand_posts = get_posts( $args );
      foreach( $rand_posts as $post ) : ?>

    • "><?php the_title(); ?>
    • <?php endforeach; ?>

    I need to change the loop from just links to excerpts and thumbnails. Part of the trick is that I only want thumbnails and excerpts for this particular page not for all excerpts.
    Here is the page so far http://wineworldwarehouse.com/testing/

    Posted 10 years ago #
  2. well you've already got a loop right? (your link is broken btw) so why not just add the_post_thumbnail() and the_excerpt() ?

    Posted 10 years ago #
  3. beanfair
    Member

    Hmm I just double checked the link and it seems to be working fine for me. http://wineworldwarehouse.com/testing/
    I guess I am confused because the code I have seen in the forums seems to add thumbnails to all excerpts and that isn't what I am trying to do. Just want the thumbnails on excerpts for this page.

    Posted 10 years ago #
  4. beanfair
    Member

    How do I get the excerpt for each post instead of the excerpt for the page? The title and permalink are showing for the post but the excerpt is showing the page that it is being displayed on.
    <?php
    $args = array( 'numberposts' => 10, 'orderby' => 'ASC', 'category' => 137 );
    $hotbuy_posts = get_posts( $args );
    foreach( $hotbuy_posts as $post ) : ?>
    <p>"><?php the_title(); ?>
    <?php the_excerpt(); ?>
    </p>
    <?php endforeach; ?>

    Posted 10 years ago #
  5. beanfair
    Member

    I have changed the code to

    <?php
    $args = array( 'posts_per_page=>5', 'orderby' => 'ASC', 'category' => 137 );
    $hotbuy_posts = get_posts( $args );
    foreach( $hotbuy_posts as $post ) :  setup_postdata($post); ?>
    	<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    	<?php the_excerpt(); ?>
    
    <?php endforeach; ?>
    <div class="entry-content">
    <?php
     the_content();
     wp_link_pages("\t\t\t\t\t<div class='page-link'>".__('Pages: ', 'thematic'), "</div>\n", 'number');
    edit_post_link(__('Edit', 'thematic'),'<span class="edit-link">','</span>') ?>
    </div><!-- .entry-content -->
    </div><!-- #post -->

    The excerpts for the hot buy posts are showing up but instead of thumbnail images the post size images are showing up instead. Also, I have lost the static text that needs to appear on that page. the_content() is not displaying the contents of the page which is displaying the hot buy post excerpts.

    Any assistance is welcomed, I am really struggling on getting this to work. Help please?

    Posted 10 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.