• Everytime I want to add a post, I want to add an image at the start of that post automatically.

    How can I do it?

    I have tried some signature plugins. But obviously, with signature plugins, the images is displayed at the end of the post but I want it to appear at the start of the post.

    The other thing I can do is to manually insert the image at the start of every post, but i am looking for a automatic solution.

    I hope you know what i am wanting to do

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • on single.php ?

    try this:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    	<?php
    	$args = array(
    				'post_type' => 'attachment',
    				'numberposts' => -1,
    				'post_status' => null,
    				'post_parent' => $post->ID
    				);
    	$attachments = get_posts($args);
    	$att = '';
    	if ($attachments) {
    		foreach ($attachments as $attachment) {
    			$att = $attachment->guid;
    		}
    	}
    	?>
    
    	<?php if ($att) : ?>
    		<div class="alignleft"><img src="<?php bloginfo('template_url'); ?>/scripts/timthumb.php?src=<?php echo $att; ?>&w=300&zc=1" class="imgthumb" /></div>
    	<?php endif; ?>
    
    	<h2><?php the_title(); ?></h2>
    
    	<?php the_content(); ?>
    
    	<div id="tagsDiv"><?php the_tags('Tags: ', ', ', ''); ?> </div>
    
    <?php endwhile; endif; ?>

    if you don’t use the timthumb, change this line:
    <div class="alignleft"><img src="<?php bloginfo('template_url'); ?>/scripts/timthumb.php?src=<?php echo $att; ?>&w=300&zc=1" class="imgthumb" /></div>
    for:
    <div class="alignleft"><img src="<?php echo $att; ?>" class="imgthumb" /></div>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How insert an image at the start of every post?’ is closed to new replies.