Hallo!
Benutze das Plug-In Automatic Post Thumb von Devolux. ICh will, dass man beim klicken auf das Thumbnail im Artikel landet. Ich habe es so versucht:
PHP
<?php $the_query = new WP_Query('cat=-' .$catid. '&showposts=15&offset=0&orderby=post_date&order=desc');
while ($the_query->have_posts()) : $the_query->the_post();
$do_not_duplicate = $post->ID; ?>
<div class="home_recent_post">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_excerpt(); ?>"><?php the_thumb(); ?></a>
<div class="home_recent_title" id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_excerpt(); ?>"><?php the_title(); ?></a>
</div>
</div>
Alles anzeigen
Beim klick auf den Titel erscheint der Artikel, beim Klick auf das Thumbnail jedoch zum Bild.
Beim title-Tag erscheint beim Bild trotz <?php the_excerpt(); ?> der Titel. Beim Titel erscheint aber das richtige.
Was mache ich falsch?
Danke!
Edit:
Hier nochmal das Plug-In:
PHP
<?php
/*
Plugin Name: Automatic Post Thumb2
Plugin URI: http://devolux.org/post-thumb
Description: The plugin generates a thumbnail from the first image uploaded to a post.
Author: Devolux
Version: 1.0
Author URI: http://devolux.org/
*/
function post_thumb2() {
global $id, $wpdb;
//reading from database
$image_data = $wpdb->get_results("SELECT guid, post_content, post_mime_type, post_title
FROM $wpdb->posts
WHERE post_type = 'attachment' && post_parent = $id && post_mime_type LIKE '%image%'
ORDER BY ID ASC");
$first_image_data = array ($image_data[0]);
//array output
foreach($first_image_data as $output) {
//if there is no description use title (filename) instead
if (empty($output->post_content) == TRUE)
{$output->post_content = $output->post_content;}
//images
if (substr($output->post_mime_type, 0, 5) == 'image')
{echo "$output->guid \n";}
else
{echo '/wp-content/plugins/post_thumb/wp_default.png';}
}
}
?>
Alles anzeigen