wp_get_attachment_image_src()函数
特色图像是wordpress主要的文章缩略图功能,可以使用add_theme_support()函数来开启缩略图功能,今天介绍
wp_get_attachment_image_src()函数 就是获取文章特色图像路径的wordpress函数,通过该函数可以返回一个包含图片路径、宽度和高度的有序数组。
语法结构
<?php wp_get_……
使用 wp_trim_words() 截取限定字数的内容
WordPress 3.3 新增了一个 wp_trim_words() 函数,专门用来截取限定字数的内容,比如文章、摘要、标题等:
1
2
3
4
5
<?php
echo wp_trim_words( get_the_content(), 100 ); // 文章内容
echo wp_trim_words( get_the_excerpt(), 100 ); // 文章摘要
echo wp……