Embed thumbnail in external website and wrap text?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Leanna
Forum Newbie
Posts: 3
Joined: Thu Jan 26, 2012 11:35 am

Embed thumbnail in external website and wrap text?

Post by Leanna »

Hi,
Please help me. I embedded my Wordpress blog's feed on my home page (non-wordpress but hosted in the same place) but can't get the text to wrap around the thumbnails. Please show me how to do this, I've tried EVERYthing...
Website: http://www.tellasia.org
Code:
In header:
<?php
// Include WordPress
define('WP_USE_THEMES', false);
require('./blog/wp-load.php');
query_posts('showposts=4');
?>

In body:
<?php while (have_posts()): the_post(); ?>
<strong><?php the_title(); ?></strong>
<p align="left"><?php add_image_size('custom-thumbnail-size', 125, 125); ?>
<?php the_post_thumbnail('custom-thumbnail-size'); ?></p>
<?php the_excerpt(); ?>
<a href="<?php the_permalink(); ?>">Read more...</a>
<?php endwhile; ?>

THANK YOU!!!
Leanna
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Embed thumbnail in external website and wrap text?

Post by Celauran »

Don't put paragraph tags around your images and use float: left
Leanna
Forum Newbie
Posts: 3
Joined: Thu Jan 26, 2012 11:35 am

Re: Embed thumbnail in external website and wrap text?

Post by Leanna »

Please show me an example of code. Do you mean put the image portion of the Php in a CSS style in the Style sheet so I can use float:left? Sorry... I'm an amateur.
Leanna
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Embed thumbnail in external website and wrap text?

Post by Celauran »

Code: Select all

<?php while (have_posts()): the_post(); ?>
<strong><?php the_title(); ?></strong><br />
<?php add_image_size('custom-thumbnail-size', 125, 125); ?>
<?php the_post_thumbnail('custom-thumbnail-size', array('class' => 'imgfloat')); ?>
<?php the_excerpt(); ?>
<a href="<?php the_permalink(); ?>">Read more...</a>
<?php endwhile; ?>
Then add this rule to your stylesheet:

Code: Select all

img.imgfloat
{
    float: left;
    margin: 0 10px 10px 0;
}
Leanna
Forum Newbie
Posts: 3
Joined: Thu Jan 26, 2012 11:35 am

Re: Embed thumbnail in external website and wrap text?

Post by Leanna »

THANK YOU, IT WORKED!! I REALLY appreciate your help!
Leanna
Post Reply