Wordpress:如何获取更多/摘录的图像?

mgP*_*ePe 1 wordpress

我需要制作一个wordpress博客节目的主页,只有1个文本的paragraf,然后是更多,并在一个很好的图像下面.

但是,摘录不会拍摄图像.

此外,如果我放置更多页面分隔符,则不会显示图像.即使它确实如此,"更多"链接应该在文本之后,而不是在图像之后.

我怎样才能使这个工作?

更新:我注意到在源代码中,有一个指向图像的链接,但它不是正确的链接.目前我的博客位于www.domain.com/wordpress,并将移至www.domain.com.

目前图片有代码:

<a href="../wp-content/uploads/2011/05/2010_06_01_archive.jpg"><img width="800" height="990" alt="" src="../wp-content/uploads/2011/05/2010_06_01_archive.jpg" title="2010_06_01_archive"></a>
Run Code Online (Sandbox Code Playgroud)

不知何故,内置链接被打破了

Joh*_*lle 6

使用wordpress的内置"特色图像"(可以在wordpress管理员的帖子编辑页面上设置).

在显示摘录的页面上:

<div id="excerpts">
    <?php
    $args = array( 'numberposts' => 3, 'category'=> '1,3,5' ); }
    // set number of excepts to show
    // and optionally restrict to certain categories
    $posts = get_posts($args);
    foreach($posts as $post) : setup_postdata($post);
    ?>
    <div class="single-excerpt">
        <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
        <?php if ( has_post_thumbnail()) the_post_thumbnail('excerpt-thumb'); ?>
        <!-- displays thumbnail if it exists -->
        <p><?php the_excerpt();?></p>
    </div><!-- single-excerpt -->
    <?php endforeach; ?>
</div><!-- excerpts -->
Run Code Online (Sandbox Code Playgroud)

在你的主题的functions.php中:

if ( function_exists( 'add_image_size' ) ) add_theme_support( 'post-thumbnails' );
if ( function_exists( 'add_image_size' ) ) { 
    add_image_size( 'excerpt-thumb', 0, 100, false );
    // define excerpt-thumb size here
    // in the example: 100px wide, height adjusts automatically, no cropping
}

function new_excerpt_length($length) {
    return 42;
    // define length of excerpt in number of words
}
add_filter('excerpt_length', 'new_excerpt_length');
Run Code Online (Sandbox Code Playgroud)