Hallo,
ich lese jetzt schon seit Tagen iim Forum, finde aber keine Lösung.
Ich habe das Theme "Gemer 1.0.2" http://wordpress.org/extend/themes/gemer
und WP 2.8.6 (ich weiß, aber momentan ist leider nichts anderes möglich...)
Auf der Startseite werden "Featured News" mit Textausschnitten und Thumbnails angezeigt. Nur leider werden die Thumbnails nicht angezeigt.
Z.B. im Archiv hingegen ist alles ok, hier werden die Thumbnails dargestellt.
Das ist die index.php:
<?php get_header(); ?>
<!-- BEGIN content -->
<div id="content">
<!-- begin featured news -->
<div class="featured">
<h2>Featured News</h2>
<div id="featured">
<?php
$tmp_query = $wp_query;
query_posts('showposts=3&cat=' . get_cat_ID(dp_settings('featured')));
if (have_posts()) :
while (have_posts()) : the_post();
?>
<!-- begin post -->
<div class="fpost">
<a href="<?php the_permalink(); ?>"><?php dp_attachment_image($post->ID, 'thumbnail', 'alt="' . $post->post_title . '"'); ?></a>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<p class="details"></p>
<p><?php echo dp_clean($post->post_content, 300); ?></p>
</div>
<!-- end post -->
<?php endwhile; endif; ?>
</div>
</div>
<!-- end featured news -->
<?php
$wp_query = $tmp_query;
if (have_posts()) :
$odd = false;
while (have_posts()) : the_post();
$odd = !$odd;
?>
<!-- begin post -->
<div class="<?php if ($odd) echo 'uneven '; ?>post">
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<a href="<?php the_permalink(); ?>"></a>
<?php $screen = get_post_meta($post->ID,'screen', true); ?>
<img src="<?php echo ($screen); ?>" width="181" height="100" alt="" />
<p><?php echo dp_clean($post->post_content, 150); ?></p>
<div class="postmeta">
<p class="category"><?php the_category(', '); ?></p>
</div>
</div>
<!-- end post -->
<?php endwhile; ?>
<div class="postnav">
<div class="navigation">
<div class="alignleft"><?php next_posts_link('« Ältere Einträge') ?></div>
<div class="alignright"><?php previous_posts_link('Neuere Einträge »') ?></div>
</div>
</div>
<?php else : ?>
<div class="notfound">
<h2>Not Found</h2>
<p>Sorry, but you are looking for something that is not here.</p>
</div>
<?php endif; ?>
</div>
<!-- END content -->
<?php get_sidebar(); get_footer(); ?>
Alles anzeigen
So sieht die archive.php aus:
<?php get_header(); ?>
<!-- BEGIN content -->
<div id="content">
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
<?php /* If this is a category archive */ if (is_category()) { ?>
<h2 class="title">Archive for the <strong><?php single_cat_title(); ?></strong> Category</h2>
<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
<h2 class="title">Posts Tagged <strong><?php single_tag_title(); ?></strong></h2>
<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
<h2 class="title">Archive for <?php the_time('F jS, Y'); ?></h2>
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<h2 class="title">Archive for <?php the_time('F, Y'); ?></h2>
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<h2 class="title">Archive for <?php the_time('Y'); ?></h2>
<?php /* If this is an author archive */ } elseif (is_author()) { ?>
<h2 class="title">Author Archive</h2>
<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<h2 class="title">Blog Archives</h2>
<?php } ?>
<?php
if (have_posts()) :
$odd = false;
while (have_posts()) : the_post();
$odd = !$odd;
?>
<!-- begin post -->
<div class="<?php if ($odd) echo 'uneven '; ?>post">
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<a href="<?php the_permalink(); ?>"><?php dp_attachment_image($post->ID, 'thumbnail', 'alt="' . $post->post_title . '"'); ?></a>
<p><?php echo dp_clean($post->post_content, 150); ?></p>
<p class="category"><?php the_category(', '); ?></p>
<p class="comments"><?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?></p>
</div>
<!-- end post -->
<?php endwhile; ?>
<div class="postnav">
<?php if(function_exists('wp_page_numbers')) { wp_page_numbers(); } ?>
</div>
<?php else : ?>
<div class="notfound">
<h2>Not Found</h2>
<p>Sorry, but you are looking for something that is not here.</p>
</div>
<?php endif; ?>
</div>
<!-- END content -->
<?php get_sidebar(); get_footer(); ?>
Alles anzeigen
und so die functions.php:
<?php
include("settings.php");
# WIDGET: Sidebar
# WIDGET: Left Sidebar
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Left Sidebar',
'before_title' => '<h2>',
'after_title' => '</h2>',
'before_widget' => '',
'after_widget' => '',
));
# WIDGET: Right Sidebar
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Right Sidebar',
'before_title' => '<h2>',
'after_title' => '</h2>',
'before_widget' => '',
'after_widget' => '',
));
# Displays a list of pages
function dp_list_pages() {
global $wpdb;
$querystr = "SELECT $wpdb->posts.ID, $wpdb->posts.post_title FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'page' ORDER BY $wpdb->posts.post_title ASC";
$pageposts = $wpdb->get_results($querystr, OBJECT);
if ($pageposts) {
foreach ($pageposts as $post) {
?><li><a href="<?php echo get_permalink($post->ID); ?>"><?php echo $post->post_title; ?></a></li><?php
}
}
}
# Displays a list of categories
function dp_list_categories($num=0, $exclude='') {
if (strlen($exclude)>0) $exclude = '&exclude=' . $exclude;
$categories = get_categories('hide_empty=1'.$exclude);
$first = true; $count = 0;
foreach ($categories as $category) {
if ($num>0) { $count++; if ($count>$num) break; } // limit
if ($category->parent<1) {
if ($first) { $first = false; $f = ' class="f"'; } else { $f = ''; }
?><li<?php echo $f; ?>>
<a href="<?php echo get_category_link($category->cat_ID); ?>"><?php echo $category->name ?><?php echo $raquo; ?></a></li>
<?php
}
}
}
# Displays a list of popular posts
function dp_popular_posts($num, $pre='<li>', $suf='</li>', $excerpt=true) {
global $wpdb;
$querystr = "SELECT $wpdb->posts.post_title, $wpdb->posts.ID, $wpdb->posts.post_content FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'post' ORDER BY $wpdb->posts.comment_count DESC LIMIT $num";
$myposts = $wpdb->get_results($querystr, OBJECT);
foreach($myposts as $post) {
echo $pre;
?><a href="<?php echo get_permalink($post->ID); ?>"><?php echo $post->post_title ?></a><?php
if ($excerpt) {
?><p><?php echo dp_clean($post->post_content, 120); ?>...</p><?php
}
echo $suf;
}
}
# Displays a list of recent categories
function dp_recent_comments($num, $pre='<li>', $suf='</li>') {
global $wpdb, $post;
$querystr = "SELECT $wpdb->comments.comment_ID, $wpdb->comments.comment_post_ID, $wpdb->comments.comment_author, $wpdb->comments.comment_content, $wpdb->comments.comment_author_email FROM $wpdb->comments WHERE $wpdb->comments.comment_approved=1 ORDER BY $wpdb->comments.comment_date DESC LIMIT $num";
$recentcomments = $wpdb->get_results($querystr, OBJECT);
foreach ($recentcomments as $rc) {
$post = get_post($rc->comment_post_ID);
echo $pre;
?><strong><a href="<?php the_permalink() ?>#comment-<?php echo $rc->comment_ID ?>"><?php echo $rc->comment_author ?></a></strong> on <a href="<?php the_permalink() ?>#comment-<?php echo $rc->comment_ID ?>"><?php echo $post->post_title; ?></a><?php
echo $suf;
}
}
# Displays post image attachment (sizes: thumbnail, medium, full)
function dp_attachment_image($postid=0, $size='thumbnail', $attributes='') {
if ($postid<1) $postid = get_the_ID();
if ($images = get_children(array(
'post_parent' => $postid,
'post_type' => 'attachment',
'numberposts' => 1,
'post_mime_type' => 'image',)))
foreach($images as $image) {
$attachment=wp_get_attachment_image_src($image->ID, $size);
?><img src="<?php echo $attachment[0]; ?>" <?php echo $attributes; ?> /><?php
}
}
# Removes tags and trailing dots from excerpt
function dp_clean($excerpt, $substr=0) {
$string = strip_tags(str_replace('[...]', '...', $excerpt));
if ($substr>0) {
$string = substr($string, 0, $substr);
}
return $string;
}
# Displays the comment authors gravatar if available
function dp_gravatar($size=50, $attributes='', $author_email='') {
global $comment, $settings;
if (dp_settings('gravatar')=='enabled') {
if (empty($author_email)) {
ob_start();
comment_author_email();
$author_email = ob_get_clean();
}
$gravatar_url = 'http://www.gravatar.com/avatar/' . md5(strtolower($author_email)) . '?s=' . $size . '&d=' . dp_settings('gravatar_fallback');
?><img src="<?php echo $gravatar_url; ?>" <?php echo $attributes ?>/><?php
}
}
# Retrieves the setting's value depending on 'key'.
function dp_settings($key) {
global $settings;
return $settings[$key];
}
?>
Alles anzeigen
Ich muss dazu sagen, dass ich im Grunde keine Ahnung habe, aber bisher durch lesen, suchen und probieren (fast) alles hinbekommen habe....
[COLOR=#000000][FONT=Lucida Grande][/FONT][/COLOR]
[COLOR=#000000][FONT=Lucida Grande]Thumbnail for Excerpts ist installiert.
[/FONT][/COLOR]
Jetzt gerade komme ich absolut nicht weiter und wäre für jede kleine Hilfe dankbar!
Vielen Dank schonmal,
mfG,
koffer