示例#1
0
    <h2 class="title"><a href="<?php 
the_permalink();
?>
"><?php 
the_title();
?>
</a></h2>
    <div class="meta">
        <div class="avatar"><?php 
echo get_avatar(get_the_author_meta('ID'), 32);
?>
</div>
        <div class="author"><?php 
the_author_posts_link();
?>
</div>
        <div class="categories"><?php 
echo get_the_category_list(', ');
?>
</div>
    </div>
    <div class="excerpt entry">
        <?php 
if (is_single()) {
    the_content();
} else {
    smart_excerpt(200);
}
?>
    </div>
</article>
示例#2
0
function _smart_alt_from_text($alt)
{
    $alt = preg_replace('/[^a-zA-Z0-9]+/i', ' ', $alt);
    // Replace non alphanumeric characters with whitespace
    $alt = preg_replace('/[ \\t\\r\\n]+/i', ' ', $alt);
    // Collapse all whitespace into single spaces
    $alt = trim($alt);
    // trim leading and trailing whitespace
    $alt = ucfirst($alt);
    // Upper-case the first letter
    $alt = smart_excerpt($alt, 12, '&hellip;', false, true);
    return $alt;
}