Ask your WordPress questions! Pay money and get answers fast! (more info)

Automatically generate thumbs from frontend in FolioGridPro 1.0.5 WordPress

  • SOLVED

i am setting a little social network with wp and bp. Here is the demo (with fonny content and users) http://lalulula.com/red/

i want both registerd authors and non registered to be able to post an image from the frotend, so i installed a "<strong>Gravity Forms</strong>" form in the sidebar to do so. i also installed "<strong>Auto Post Thumbnail</strong>" plugin so that the post will display the thumb on the index page.

And here comes the problem:

the form works great and the featured image is automatically generated (it appears in the backend settings of the post), but the thumb doesnt appear in the index. (the ones that appear rigth now i had to set them from the backend)
i am using <strong>FolioGrid Pro 1.0.5 theme</strong>, and it has a special feature regarding the thumbs display when editing post from the backend.<strong> i am assuming this is what forbids the thumb to be automatically displayed i the index.</strong>

i have tryed with diferet frontend posting and diferent automatically generate thumbs methods, but the problem remains.

i am hopping some of you can figure out a way to achieve this.

i am using WordPress 3.4.2 and Buddypress 1.6.1 if it helps.

Answers (3)

2012-12-16

phppoet answers:

You can add post thumbnail to index page by just adding 1 simple code line .

the_post_thumbnail( array(100,100) );

uninstall auto post thumbnail and add this code to your themes index.php just after the_title( );


100, 100 in the_post_thumbnail( array(100,100) ); is for the size of thumbnail . adjust size as per your need.

i hope this will work for you .

2012-12-17

Ellah Alzona answers:

Un install the Auto Post Thumbnail Plugin and add this lines somewhere in your "functions.php"




add_theme_support('post-thumbnails');
add_image_size('custom_thumb', 200, 200, true);

add_filter('the_excerpt','excerpt_thumbnail');

function excerpt_thumbnail($excerpt)
{
if(is_single()) return $excerpt;
global $post;
if ( has_post_thumbnail() )
{
$img .= '<a href=" '.get_permalink($post->ID).' ">'.get_the_post_thumbnail($post->ID, 'custom_thumb').'</a>';
} else {
$img = 'http://website.com/link-of-a-dummy-image.jpg';
}
return $img.$excerpt;
}



Then Go to your stylesheet to play around with the style:

The class of your featured image thumbnail will be .attachment-custom_thumb so if you want to style it you can just add these lines to your style.css file (your theme style-sheet):



.attachment-custom_thumb { float: left; margin: 2px; }


No need to edit your index or other template pages.

Let me know if this works with you.


Ellah Alzona comments:

If the scripts above wont work, try the simplier one.
Go to your index.php and these somewhere below the "<?php the_title(); ?>" or upto you.



<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}?>


Let me know if this works with you.


lalulula comments:

ok, i dont whant to call the 'the_excerpt' so i just used

<?php if ( has_post_thumbnail() ) { the_post_thumbnail( );; }?>

and it works :)

but now i am wondering if it is posible to only set a maximum width for the thumbs insted of giving them a 200 x 200 size, beacause when you upload an image that is not square it reduces too much.
can that be done?


lalulula comments:

nevermind, i figured it out :)
i used the_post_thumbnail( array(200, 9999) );;

thnks so much!!!

2012-12-16

Arnav Joy answers:

can you share the function which shows posts to front end , also show how it shows thumbnails