1.wordpress怎样调用文章缩略图
第一步:在主题模板的function.php里添加下面的函数,代码如下:
//截取内容中第一张图片函数
function catch_that_image() {
global $post, $posts;
ob_start();
ob_end_clean();
preg_match('/<imgs[^<>]*?src=['"]([^'"<>]+?)['"][^<>]*?>/i', $post->post_content, $matche);
if($matche[1])
return $matche[1];
//否则取默认图片
return 'default.gif';
}
第二步:在wordpress需要调用缩略图的地方直接用这个函数调用,如下面例子,代码如下:
<img src="<?php echo catch_that_image(); ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>" width="200px" height="200px" />
2.为什么我的WordPress插入图片后不能显示原大小,而只是缩略图
WordPress图片解决方案。
提供了多个基于WordPress上的图片/相册解决方案。 经过一些试用,我的首选还是Menalto Gallery,主要是因为我需要一次上载多张图片,又比较熟悉它的安装界面。
看来Pictorialis也很有潜力,当然这里面列举的软件各自面向不同的用户需要。我的总结可能有些以偏概全了,欢迎大家留言写下自己的心得!我们插入的图片默认是靠左的,下面来看看如何修改:1.移动到中间在你的css里加入下面的代码:div.cent { text-align: center;}虽然是'text-align',但对图片也有效。
然后如果你想把图片居中的话,加入下面的代码:Everything here will be centred 然后你需要一些代码和图片,你可以到这个网站去找:/archives/2004/03/24/wordpress-javascript-quicktags/2.文字在右边环绕图片先在css里加入下面的代码:div.clearer {clear: left;line-height: 0;height: 0;} 然后在你插入的最后一张图片,但是在文字结束之前,加入下面的代码: 3.文字在左边环绕图片把下面的代码复制到你的css中:.img-shadow1 {clear: both;float:right;background: url(images/shadowAlpha.png) no-repeat bottom right !important;background: url(images/shadow.gif) no-repeat bottom right;margin: 20px 0 0 17px !important;margin: 20px 0 0 8px;}.img-shadow1 img {display: block;position: relative;background-color: #fff;border: 1px solid #a9a9a9;margin: -6px 6px 6px -6px;padding: 4px;} wordpress(r522) 不显示图片解决办法wordpress mu r522 版本安装成功后,后台上传图片问题。1,上传图片,但是预览不显示2,通过ftp查看目录,图片已上传成功,可以判断问题在应该出现在.htaccess中,解决办法按照如下修改.htaccessRewriteRule ^([_0-9a-zA-Z-]+)/files/(.*) /wp-inst/wp-content/blogs.php?file=$2 [L]RewriteRule ^([_0-9a-zA-Z-]+)/wp-content/blogs/(.*)/files/(.*) /wp-inst/wp-content/blogs.php?file=$3 [L]RewriteRule ^([_0-9a-zA-Z-]*)/?files/(.*) /wp-inst/wp-content/blogs.php?file=$2 [L]RewriteRule ^([_0-9a-zA-Z-]*)/?wp-content/blogs/(.*)/files/(.*) /wp-inst/wp-content/blogs.php?file=$3 [L] wordpress随机换图片的方法:把模版的header换成了随机显示的图片,方法很简单,把这段代码保存成php文件(例如rotate.php),将rotate.php放到和图片相同的文件夹里,然后在模版里加入代码就可以了<--img src="。
/rotate.php" alt="A Random Image" -="">.。
转载请注明出处51数据库 » wordpress缩略图gif
--img>