WordPress.org

Ready to get started?Download WordPress

Forums

blogpost & thumbnails do not display. (5 posts)

  1. pdxDaniela
    Member
    Posted 11 months ago #

    Hello.
    Trying to get my posts to display at the bottom of the page in four separate slots.

    i have enabled the thumbnails function in functions.php

    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 50, 50, true );

    and started adding this code to the index.php page.

    <div id="row02" class="row-fluid">
    <div class="thumbnails">
    
    			<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    			<div class="span3">
    
    			<?php the_post_thumbnail(); ?>
    			<h4><?php the_title(); ?></h4>
    			<?php include (TEMPLATEPATH . '/inc/meta.php' ); ? >
    
    			<?php the_excerpt(); ?>
    			<a href="<?php the_permalink(); ?>" class="btn btn-mini">read more</a>
    			</div>	
    
    			<?php endwhile; endif; ?>
    
    			</div>	
    
    			<div class="span3">
    			span3
    			</div>
    			<div class="span3">
    			span3
    			</div>	
    
    			<div class="span3">
    			span3
    			</div>
    </div> <!-- end thumbnails -->
    </div> <!-- end row -->

    better yet I would like a post from specific categories show up in each slot. so far it isn't quite working. so slot 1 is engineering, slot two grabs the post from IT. And so on
    When I put it in the page.php it was simply grabbing the text from the page it was on.
    in index.php it is grabbing something...
    and the thumbnails are not showing up.

    Thank you
    D

  2. pdxDaniela
    Member
    Posted 11 months ago #

    And something is showing up in chrome. but not firefox.

  3. alchymyth
    The Sweeper & Moderator
    Posted 11 months ago #

    have you added 'featured images' to the posts?

    if you are planning to use the code in a page.php or a page template, you will need to add a query to tell the loop what to show; in this case, it will be better if you use WP_Query() instead of query_posts() http://wordpress.stackexchange.com/questions/1753/when-should-you-use-wp-query-vs-query-posts-vs-get-posts?rq=1

    http://codex.wordpress.org/Function_Reference/WP_Query

    http://codex.wordpress.org/Function_Reference/WP_Query#Category_Parameters

  4. pdxDaniela
    Member
    Posted 11 months ago #

    yep. I did add the "featured images" in the appropriate wp-admin area (but good point on asking, sometimes it's the obvious that trips people up)

    Will look up the WP_Query()Thank for the info.
    Thank you
    D

  5. pdxDaniela
    Member
    Posted 11 months ago #

    Hi there finally got it to work by using

    <?php query_posts("post_per_page=2"); the_post(); ?>
    			<?php the_date(); ?>
    			<?php the_post_thumbnail(); ?>
    			<h4><?php the_title(); ?></h4>
    			<?php the_excerpt(); ?>
    			<a href="<?php the_permalink(); ?>" class="btn btn-mini">read more</a>
    			<?php wp_reset_query(); ?>

    but what exactly is <?php wp_reset_query(); ?> for? and how do i get to show the four more recent post by their category?

Reply

You must log in to post.

About this Topic