• Hey all! First of all, it’s a pleasure to meet everyone and I thank everyone in advance who attempts to help me.

    Now before you assume I mean an image in an article. I am talking about a site like this.

    http://www.fashionablylatemag.com

    The images on the main pages aren’t clickable and the only way to move to the article in question is via the link above or the more button below.

    I’ve browsed the php files and I found the following line:

    ‘<div class=”post-headings”>
    <span class=”meta”>by <?php the_author_posts_link(); ?> _ <?php the_time(‘F d, Y’); ?> <?php edit_post_link(__(‘« edit »’)); ?></span>
    <h2>” title=”Continue reading <?php the_title_attribute(); ?>”><?php cut_the_title($post->ID); ?></h2>
    <span class=”meta”>Posted in <?php the_category(‘, ‘) ?></span>
    </div>

    <?php if(catch_first_image()): ?>

    <?php echo catch_first_image(); ?>

    <?php endif; ?>

    <?php the_excerpt(); ?>’

    I notice the “catch_first_image” area and for the life of me I cannot figure out what to put in that vicinity to make sure each image that it “catches” makes the image clickable to the appropriate post. Any suggestions?

    Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi,
    Here is an example for post thumbnail, where I wrap the image in a div
    Both the image is clickable.

    <?php if(has_post_thumbnail()): ?>
    <div class="cms-image" style="float: left;">
    <a href="<?php the_permalink() ?>"> <?php the_post_thumbnail(); ?></a>
    </div>
    <?php endif; ?>

    HTH

    David

    Thread Starter ctrl-alt-rage

    (@ctrl-alt-rage)

    David,

    Thanks a lot for your reply.

    On the front page of the site I posted above, it gathers the images that were put into each article written, throws the newest ones on the front page of the site and archives the older ones into subcategories.

    Would the above code you offered work for that? Would you mind helping me with where I would place it in the above code?

    Any help would be appreciated and again, thanks for helping!

    try… justin tadlock’s “get the image” plugin

    Thread Starter ctrl-alt-rage

    (@ctrl-alt-rage)

    Perth,

    That plugin is PERFECT!

    Thanks a lot for the help!

    One question though, and I can’t seem to find the answer online.

    If I post this code.

    <?php get_the_image( array( 'custom_key' => array( 'feature_img' ), 'size' => 'medium', 'width' => '304', 'height' => '98', 'image_class' => 'feature' ) ); ?>

    It will shrink the image down to the size I need it, but it shrinks the entire image when all I need it to do is crop it to that size.

    If you notice the site in my first post, the images are just cropped to that size and not “resized” if that makes sense.

    In the above line of code, do you have any suggestions for me to get it to crop the image like it does already?

    Thanks again for the suggestion!

    change the crop setting in the media tab

    Thread Starter ctrl-alt-rage

    (@ctrl-alt-rage)

    Perth,

    Thanks for the suggestion, that was what I originally had taken a look at. But it seems the crop code if overwritten when implementing the plugin.

    Do you have any direction I should go in? And your help is greatly appreciated yet again.

    In your functions.php look and see if post thumbnails are activated, and use add_image_size for your custom images.

    // This theme uses post thumbnails
    add_theme_support( 'post-thumbnails' );
    
    // We'll be using custom post thumbnails.
    set_post_thumbnail_size( 120, 90, true );
    
    // Add a couple of Custom Imasge Sizes
    if ( function_exists( 'add_image_size' ) ) {
    	add_image_size( 'large-thumbnail', 200, 150, true );
        add_image_size( 'small-thumbnail', 100, 75 );
    }

    Call the image size you want in your loops, large thumbnail and post excerpt, this is just an example.

    <div class="entry-content">
    	<?php /* Add a conditional image and excerpt output */ ?>
    	<?php if(has_post_thumbnail()): // Start the condition ?>
    		<div class="alignleft" style="margin: 0 0 10px 0">
    		<?php the_post_thumbnail('large-thumbnail'); ?>
    		</div>
    		<?php the_excerpt(); ?>
    	<?php else : // Offer an alternative ?>
    		<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) ); ?>
    	<?php endif; // end the condition ?> 
    
    	<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
    </div><!-- .entry-content -->

    If you are still not sure work through this twenty ten tutorial.

    In the link you posted it is a mixture of post images and two column and the columns in the link are 310px, so you could add

    add_image_size( 'large-thumbnail', 300, 100, true );

    The images in your link are 310px * 100px, these are crops of a full size image!

    HTH

    David

    Thread Starter ctrl-alt-rage

    (@ctrl-alt-rage)

    Hey guys,

    I apologize it has taken so long to get back to your replies. They have been greatly appreciated! I am still incredibly confused and I cannot seem to get the code to do what I want.

    I am using the get-the-image plugin but I am not having any luck maintaining the size of the images to what I originally want.

    Unfortunately, this theme was created prior to the site owners asking for my help and they insist on wanting to keep it, which I can understand. If anyone can help me more on this, I would be incredibly grateful. I know it’s a headache to help a “noob” but the more help I get, the less questions I’ll have to ask! 😀

    Thanks in advance.

    Thread Starter ctrl-alt-rage

    (@ctrl-alt-rage)

    I am just gonna bump this up. Any help would be greatly appreciated. This is the only thing left I need to finish the site.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Making images clickable.’ is closed to new replies.