• I am having two problems that I am wondering if one of the WP gurus can help with.

    1. Thumbnails generated by custom fields. I was able to find a solution for this:

    <img class="thumb_left" src="<?php echo get_post_meta($post->ID, "Thumbnail", true);?>" />

    Now where I am needing help is.. in the case that there is no Thumbnail provided via custom field, any way I can have the post default to attached image as its thumbnail? And if no attached image, no thumbnail.

    2. Varying loop by category in sidebar.

    I have 3 pages – golf, tennis, jogging.

    I want each of those 3 pages to have its own sidebar with the appropriate category loop.

    So here is what I have so far (just a short excerpt)

    <?php
    	if ( is_page('Car Insurance') ) {
    
    <ul>
    <?php query_posts('category_name=car-insurance&showposts=10'); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    <li><a>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
    <?php the_excerpt(); ?></li>
    <?php endwhile; ?><?php endif; ?>
    </ul>
      		} elseif ( is_page('Home Insurance') ) {
    
    <ul>
    <?php query_posts('category_name=home-insurance&showposts=10'); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    <li><a>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
    <?php the_excerpt(); ?></li>
    <?php endwhile; ?><?php endif; ?>
    </ul>
    }
    ?>

    Doesn’t seem to be working and I am very new to PHP.
    Thanks in advance!

The topic ‘Couple questions’ is closed to new replies.