예제 #1
0
function the_shortcode_excerpt()
{
    # Determine if the post_content column contains the string [gallery]
    if (gallery_shortcode_exists()) {
        # Get the first three attachments using the posts_per_page parameter
        $args = array('post_type' => 'attachment', 'post_mime_type' => 'image', 'posts_per_page' => 3, 'post_parent' => get_the_ID());
        $attachments = get_children($args);
        # If any attachments are returned, proceed
        if ($attachments) {
            # Spin cycle to collate attachment IDs
            foreach ($attachments as $attachment) {
                $includes[] = $attachment->ID;
            }
            # Format our IDs in a comma-delimited string
            $includes = implode(',', $includes);
            # Inject your include argument
            $shortcode = str_replace('[gallery', "[gallery include='{$includes}' ", get_the_content());
            # Render the Gallery using the standard editorial input syntax
            echo do_shortcode($shortcode);
            # Add a View More link
            echo '<a href="' . get_permalink() . '">' . __('View more', 'domain') . '</a>';
        } else {
            _e('Foo Bar - No attachments found and no excerpt to display', 'domain');
        }
    } else {
        # Whatever fallback you desire
        the_excerpt();
    }
}
예제 #2
0
                echo force_balance_tags($quote_author);
                ?>
</cite>
					<?php 
            }
            ?>
						</blockquote>
    <?php 
        }
    }
}
if (is_single()) {
    the_content();
} else {
    if (!empty($blog_settings['blog_excerpt'])) {
        if (gallery_shortcode_exists()) {
            mango_gallery();
        } else {
            if (!$quote) {
                echo mango_excerpt($blog_settings['blog_excerpt_limit']);
            }
        }
    } else {
        the_content();
    }
}
?>
</div><!-- End .entry-content -->
<?php 
if (!is_single() && $blog_settings['blog_excerpt'] && !post_password_required()) {
    ?>