GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   How to have two image sizes in WP? (https://gfy.com/showthread.php?t=1041353)

Badmaash 10-11-2011 03:51 AM

How to have two image sizes in WP?
 
Hi

Okay so lets say I want 500px Width images in index of wordpress, but when you click on the post the image size changes to say 800px - is this possible?

Thanks

B

Dappz 10-11-2011 03:55 AM

yes it will posible :)

fris 10-11-2011 04:15 AM

Quote:

Originally Posted by Badmaash (Post 18483197)
Hi

Okay so lets say I want 500px Width images in index of wordpress, but when you click on the post the image size changes to say 800px - is this possible?

Thanks

B

add a custom image size

http://codex.wordpress.org/Function_...add_image_size

Dejan 10-11-2011 04:18 AM

First of all enable "Custom Fields" under "Screen Options".
under "Name" put "thumb" and under "Value" insert link to your 500px picture.
Next you need to edit your index.php file and add this:

Code:

<?php if( get_post_meta($post->ID, "thumb", true) ): ?>

                                <p><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">

                        <img src="<?php $values = get_post_custom_values("thumb"); echo $values[0]; ?>" height="120" width="160" alt="<?php the_title(); ?>" /></a></p>


fris 10-11-2011 07:30 AM

Quote:

Originally Posted by Dejan (Post 18483216)
First of all enable "Custom Fields" under "Screen Options".
under "Name" put "thumb" and under "Value" insert link to your 500px picture.
Next you need to edit your index.php file and add this:

Code:

<?php if( get_post_meta($post->ID, "thumb", true) ): ?>

                                <p><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">

                        <img src="<?php $values = get_post_custom_values("thumb"); echo $values[0]; ?>" height="120" width="160" alt="<?php the_title(); ?>" /></a></p>


why use custom fields?

all that extra work is pointless.

V_RocKs 10-11-2011 11:19 AM

add to functions.php:
Code:

add_theme_support( 'post-thumbnails' );
add_image_size( 'homepage-thumb', 500, 2000 ); // 500 pixels wide by 2000 pixels tall, soft proportional crop mode

Inside index.php put:
Code:

<?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'homepage-thumb' ); } ?>
That is in place of your normal thumb. Then it will be smaller.

V_RocKs 10-11-2011 11:20 AM

Then install this if you have been using a different size:
http://wordpress.org/extend/plugins/...te-thumbnails/

Personally I would use excerpt to produce the text and maybe put something like this in functions.php:
Code:

function new_excerpt_length($length) {
        return 75;
}
add_filter('excerpt_length', 'new_excerpt_length');

TO change the length of the excerpt to be a bit larger... But then I write larger posts than most people...

fris 10-11-2011 12:10 PM

Quote:

Originally Posted by V_RocKs (Post 18484077)
Then install this if you have been using a different size:
http://wordpress.org/extend/plugins/...te-thumbnails/

Personally I would use excerpt to produce the text and maybe put something like this in functions.php:
Code:

function new_excerpt_length($length) {
        return 75;
}
add_filter('excerpt_length', 'new_excerpt_length');

TO change the length of the excerpt to be a bit larger... But then I write larger posts than most people...

i usally just trim the content, writing in excerpt and a post is annoying


All times are GMT -7. The time now is 10:52 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123