问题描述
|
我需要在wordpress博客的首页上显示仅1个paragraf文本,然后显示更多文本,并在一个漂亮的大图片下面。
但是,摘录不拍摄图像。
另外,如果我放置更多的页面分隔线,则不会出现图像。即使是,\“ more \”链接也应该位于文本之后,而不是图像之后。
我该如何工作?
更新:
我注意到在源代码中有一个指向图像的链接,但这不是正确的链接。
目前,我的博客位于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>
内置链接以某种方式被破坏
解决方法
使用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 -->
在主题的functions.php中:
if ( function_exists( \'add_image_size\' ) ) add_theme_support( \'post-thumbnails\' );
if ( function_exists( \'add_image_size\' ) ) {
add_image_size( \'excerpt-thumb\',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\');
,您还可以使用Wordpress插件Easy Custom Auto Excerpt,该插件使您可以将摘录配置为包括简码,图像和所有HTML。
,确保图像尺寸适当,并且物理尺寸尽可能最小。 (Gif通常是最好的格式。)
http://codex.wordpress.org/Image_Size_and_Quality