WordPress.org

Ready to get started?Download WordPress

Forums

.entry custom background image using custom fields (3 posts)

  1. Gr1f
    Member
    Posted 4 years ago #

    Hi folks. Looking for a way to apace a path to an image in a Custom Field that will become the background image to the div class .entry.

    my PHP is extremely limited so any help appreciated!

  2. Gr1f
    Member
    Posted 4 years ago #

    I was trying something like this in the loop:

    <div id="content" class="narrowcolumn">
    <?php query_posts('category_name=testimonial&showposts=100'); ?>
    
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div class="post" id="post-<?php the_ID(); ?>">
    
            <div class="lead-image-wrapper">
    		<h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    
            <?php $image = get_post_meta($post->ID, 'lead_image', true); ?>
    <img src='<?php echo $image; ?>' />
    
    			<div class="entry">
    				<?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>
    
    				<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    
    	<small id="comments"><?php comments_number('No Comments yet', 'One Comment', '% Comments' );?> to “<?php the_title(); ?>” <br /><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">View Event / Comment on Event</a></small>
    
    			</div>
    		</div>
            </div class="lead-image-wrapper">

    where I would specify a custom field "lead-image"

  3. Gr1f
    Member
    Posted 4 years ago #

    OK, stupid me......
    I just say the problem:

    template looks for lead_image

    custom field specified lead-image

    :-)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.